| Total Complexity | 6 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 10 | class AggregateUuid implements EntityIdentifier |
||
| 11 | { |
||
| 12 | /** @var UuidInterface */ |
||
| 13 | private $uuid; |
||
| 14 | |||
| 15 | private function __construct(UuidInterface $uuid) |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @return static |
||
| 22 | */ |
||
| 23 | public static function createRandom(): self |
||
| 24 | { |
||
| 25 | return new static(Uuid::uuid4()); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $leaflet The compact representation of this instance. |
||
| 30 | * |
||
| 31 | * @return static The instance reconstituted from unfolding the leaflet. |
||
| 32 | * @throws InvalidUuidStringException When the leaflet is not a valid UUID string. |
||
| 33 | */ |
||
| 34 | public static function unfold(string $leaflet): Foldable |
||
| 35 | { |
||
| 36 | return new static(Uuid::fromString($leaflet)); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param mixed $other Another value to test. |
||
| 41 | * |
||
| 42 | * @return bool True when the other value is equal to this instance. |
||
| 43 | */ |
||
| 44 | public function equals($other): bool |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return string A compact representation (like a leaflet) of this instance. |
||
| 51 | */ |
||
| 52 | public function fold(): string |
||
| 55 | } |
||
| 56 | } |
||
| 57 |