Total Complexity | 4 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class AddressChangeId { |
||
8 | |||
9 | private const VALID_PATTERN = '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$'; |
||
10 | |||
11 | private string $identifier; |
||
12 | |||
13 | private function __construct( string $id ) { |
||
14 | if ( !preg_match( '/' . self::VALID_PATTERN . '/D', $id ) ) { |
||
15 | throw new \InvalidArgumentException( 'Identifier must be a valid UUID ' ); |
||
16 | } |
||
17 | $this->identifier = $id; |
||
18 | } |
||
19 | |||
20 | public static function fromString( string $id ): self { |
||
22 | } |
||
23 | |||
24 | public function __toString(): string { |
||
26 | } |
||
27 | |||
28 | } |