Files
michaelschiemer/src/Framework/Notification/Templates/ChannelTemplate.php
Michael Schiemer 3b623e7afb feat(Deployment): Integrate Ansible deployment via PHP deployment pipeline
- Create AnsibleDeployStage using framework's Process module for secure command execution
- Integrate AnsibleDeployStage into DeploymentPipelineCommands for production deployments
- Add force_deploy flag support in Ansible playbook to override stale locks
- Use PHP deployment module as orchestrator (php console.php deploy:production)
- Fix ErrorAggregationInitializer to use Environment class instead of $_ENV superglobal

Architecture:
- BuildStage → AnsibleDeployStage → HealthCheckStage for production
- Process module provides timeout, error handling, and output capture
- Ansible playbook supports rollback via rollback-git-based.yml
- Zero-downtime deployments with health checks
2025-10-26 14:08:07 +01:00

56 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Notification\Templates;
/**
* Channel-specific Template Customization
*
* Allows overriding title/body templates per channel
* Use case: Telegram supports Markdown, Email supports HTML, SMS is plain text
*/
final readonly class ChannelTemplate
{
/**
* @param string|null $titleTemplate Channel-specific title template (null = use default)
* @param string|null $bodyTemplate Channel-specific body template (null = use default)
* @param array<string, mixed> $metadata Channel-specific metadata (e.g., parse_mode for Telegram)
*/
public function __construct(
public ?string $titleTemplate = null,
public ?string $bodyTemplate = null,
public array $metadata = []
) {
}
public static function create(
?string $titleTemplate = null,
?string $bodyTemplate = null
): self {
return new self(
titleTemplate: $titleTemplate,
bodyTemplate: $bodyTemplate
);
}
public function withMetadata(array $metadata): self
{
return new self(
titleTemplate: $this->titleTemplate,
bodyTemplate: $this->bodyTemplate,
metadata: [...$this->metadata, ...$metadata]
);
}
public function hasCustomTitle(): bool
{
return $this->titleTemplate !== null;
}
public function hasCustomBody(): bool
{
return $this->bodyTemplate !== null;
}
}