Total Complexity | 6 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 73.32% |
Changes | 0 |
1 | <?php |
||
7 | class State |
||
8 | { |
||
9 | const INITIAL = 'initial'; |
||
10 | const NORMAL = 'normal'; |
||
11 | const FINAL = 'final'; |
||
12 | |||
13 | private string $type; |
||
14 | private string $name; |
||
15 | private array $metadata; |
||
16 | |||
17 | 21 | private function __construct(string $type, string $name, array $metadata = []) |
|
18 | { |
||
19 | 21 | $this->type = $type; |
|
20 | 21 | $this->name = $name; |
|
21 | 21 | $this->metadata = $metadata; |
|
22 | 21 | } |
|
23 | |||
24 | 21 | public function name(): string |
|
25 | { |
||
26 | 21 | return $this->name; |
|
27 | } |
||
28 | |||
29 | 6 | public function metadata(): array |
|
30 | { |
||
31 | 6 | return $this->metadata; |
|
32 | } |
||
33 | |||
34 | public static function initialTyped(string $name, array $metadata): self |
||
35 | { |
||
36 | return new static(static::INITIAL, $name, $metadata); |
||
37 | } |
||
38 | |||
39 | 21 | public static function normalTyped(string $name, array $metadata): self |
|
42 | } |
||
43 | |||
44 | public static function finalTyped(string $name, array $metadata): self |
||
47 | } |
||
48 | } |
||
49 |