- Added IcsGeneratorService for generating ICS content. - Updated MissingOrderReminderNotification to include cutoff date and ICS content. - Refactored SendMissingOrderReminderJob to utilize new ICS generation logic. - Introduced IcsContent value object for better ICS content handling. - Added tests for new functionality in SendMissingOrderReminderJob and IcsGeneratorService.
26 lines
648 B
PHP
26 lines
648 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
use Webmozart\Assert\Assert;
|
|
|
|
final readonly class IcsContent implements \Stringable
|
|
{
|
|
public function __construct(
|
|
public string $value,
|
|
) {
|
|
$trimmed = trim($value);
|
|
|
|
Assert::stringNotEmpty($trimmed, 'ICS content cannot be empty.');
|
|
Assert::startsWith($trimmed, 'BEGIN:VCALENDAR', 'ICS content must start with BEGIN:VCALENDAR.');
|
|
Assert::endsWith($trimmed, 'END:VCALENDAR', 'ICS content must end with END:VCALENDAR.');
|
|
}
|
|
|
|
#[\Override]
|
|
public function __toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|