Total Complexity | 8 |
Total Lines | 69 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class IdentitySegment implements Segment |
||
10 | { |
||
11 | public const NAME = 'identity_segment'; |
||
12 | private string $id; |
||
13 | /** |
||
14 | * @var array<string, mixed> |
||
15 | */ |
||
16 | private array $criteria; |
||
17 | |||
18 | /** |
||
19 | * Segment constructor. |
||
20 | * |
||
21 | * @param string $id |
||
22 | * @param array<string, mixed> $criteria |
||
23 | */ |
||
24 | 8 | public function __construct(string $id, array $criteria) |
|
28 | 8 | } |
|
29 | |||
30 | 4 | public function id(): string |
|
31 | { |
||
32 | 4 | return $this->id; |
|
33 | } |
||
34 | |||
35 | 4 | public function type(): string |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return array<string, mixed> |
||
42 | */ |
||
43 | 4 | public function criteria(): array |
|
46 | } |
||
47 | |||
48 | 6 | public function match(array $payload): bool |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return array<string, string|array> |
||
62 | */ |
||
63 | 5 | public function toArray(): array |
|
64 | { |
||
65 | return [ |
||
66 | 5 | 'id' => $this->id, |
|
67 | 5 | 'type' => self::NAME, |
|
68 | 5 | 'criteria' => $this->criteria, |
|
69 | ]; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return array<string, string|array> |
||
74 | */ |
||
75 | 4 | public function jsonSerialize(): array |
|
78 | } |
||
79 | } |
||
80 |