Total Complexity | 6 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 100% |
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 | 8 | private function __construct( string $id ) { |
|
14 | 8 | if ( !preg_match( '/' . self::VALID_PATTERN . '/D', $id ) ) { |
|
15 | 5 | throw new \InvalidArgumentException( 'Identifier must be a valid UUID ' ); |
|
16 | } |
||
17 | 3 | $this->identifier = $id; |
|
18 | } |
||
19 | |||
20 | 8 | public static function fromString( string $id ): self { |
|
22 | } |
||
23 | |||
24 | 1 | public function __toString(): string { |
|
26 | } |
||
27 | |||
28 | 2 | public function equals( string|AddressChangeId $id ): bool { |
|
33 |