23 lines
495 B
PHP
23 lines
495 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Domain\Models\ValueObjects\Entities;
|
||
|
|
|
||
|
|
use Shared\DDD\EntityId;
|
||
|
|
|
||
|
|
final readonly class ArcadiaEmployeeId extends EntityId
|
||
|
|
{
|
||
|
|
private const PATTERN = '/^\d{7,8}$/';
|
||
|
|
|
||
|
|
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
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|