2026-08-12 15:45:29 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-08-14 11:33:05 +02:00
|
|
|
namespace Domain\Models\ValueObjects\Entities;
|
2026-08-12 15:45:29 +02:00
|
|
|
|
2026-08-14 11:33:05 +02:00
|
|
|
use Shared\DDD\EntityId;
|
|
|
|
|
|
|
|
|
|
final readonly class IncoId extends EntityId
|
2026-08-12 15:45:29 +02:00
|
|
|
{
|
|
|
|
|
private const PATTERN = '/^\d{1,}$/';
|
|
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
|
public readonly string $value
|
|
|
|
|
) {
|
|
|
|
|
if (! preg_match(self::PATTERN, $value)) {
|
|
|
|
|
throw new \DomainException(
|
|
|
|
|
"Invalid value '{$value}' does not match pattern " . self::PATTERN
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|