Publication initiale de RelaisSMS : documentation et sources nettoyees

This commit is contained in:
2026-10-21 09:29:39 +02:00
commit ac186b03b1
158 changed files with 24818 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Services\Sms;
use App\Models\AppSetting;
class SmsMessageComposer
{
/**
* @return array{header: string, footer: string}
*/
public function settings(): array
{
return [
'header' => AppSetting::string('sms_message_header'),
'footer' => AppSetting::string('sms_message_footer'),
];
}
public function compose(string $body, bool $includeHeader = true, bool $includeFooter = true): string
{
$settings = $this->settings();
$parts = [];
if ($includeHeader && $settings['header'] !== '') {
$parts[] = $settings['header'];
}
if (trim($body) !== '') {
$parts[] = trim($body);
}
if ($includeFooter && $settings['footer'] !== '') {
$parts[] = $settings['footer'];
}
return implode("\n", $parts);
}
}