Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
13 | class AggregateId implements AggregateIdInterface |
||
14 | { |
||
15 | public const PATTERN = '/^.*$/'; |
||
16 | |||
17 | private string $id; |
||
18 | |||
19 | /** |
||
20 | * @param string $id |
||
21 | * @return static |
||
22 | */ |
||
23 | 8 | public static function fromNative($id): self |
|
24 | { |
||
25 | 8 | Assertion::regex($id, static::PATTERN, 'Invalid id format.'); |
|
26 | 8 | return new static($id); |
|
27 | } |
||
28 | |||
29 | 6 | public function toNative(): string |
|
30 | { |
||
31 | 6 | return $this->id; |
|
32 | } |
||
33 | |||
34 | /** @param static $comparator */ |
||
35 | 4 | public function equals($comparator): bool |
|
39 | } |
||
40 | |||
41 | 6 | public function __toString(): string |
|
44 | } |
||
45 | |||
46 | 8 | private function __construct(string $id) |
|
51 |