2026-09-21 16:59:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
|
|
|
|
|
|
use Shared\DDD\Models\Equatable;
|
|
|
|
|
|
|
|
|
|
final readonly class ProcessingCode implements \Stringable, Equatable
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
public string $value,
|
|
|
|
|
) {
|
2026-09-24 14:29:26 +02:00
|
|
|
$trimmed = mb_trim($this->value);
|
2026-09-21 16:59:26 +02:00
|
|
|
|
|
|
|
|
if ($trimmed === '') {
|
2026-09-22 12:45:08 +02:00
|
|
|
throw new \DomainException('Processing Code value cannot be empty.');
|
2026-09-21 16:59:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[\Override]
|
|
|
|
|
public function equals(mixed $other): bool
|
|
|
|
|
{
|
|
|
|
|
return $other instanceof self && $this->value === $other->value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __toString(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->value;
|
|
|
|
|
}
|
|
|
|
|
}
|