Total Complexity | 5 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
5 | abstract class Identifier |
||
6 | { |
||
7 | private $id; |
||
8 | |||
9 | private function __construct(string $id) |
||
10 | { |
||
11 | $this->id = $id; |
||
12 | } |
||
13 | |||
14 | /** @return static */ |
||
15 | public static function from($id): self |
||
16 | { |
||
17 | return new static((string) $id); |
||
18 | } |
||
19 | |||
20 | public function is(self $that): bool |
||
21 | { |
||
22 | return (string) $this === (string) $that; |
||
23 | } |
||
24 | |||
25 | public function id(): string |
||
26 | { |
||
27 | return $this->id; |
||
28 | } |
||
29 | |||
30 | public function __toString(): string |
||
33 | } |
||
34 | } |
||
35 |