Total Complexity | 8 |
Total Lines | 92 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class RuleDTO |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $tag; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $operator; |
||
18 | |||
19 | /** |
||
20 | * @var string|array|null |
||
21 | */ |
||
22 | private $key; |
||
23 | |||
24 | /** |
||
25 | * @var string|array|null |
||
26 | */ |
||
27 | private $value; |
||
28 | |||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | private $noKey; |
||
33 | |||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | private $alterNext; |
||
38 | |||
39 | 348 | private function __construct(array $values) |
|
47 | 348 | } |
|
48 | |||
49 | /** |
||
50 | * @param string|array|null $key |
||
51 | * @param string|array|null $value |
||
52 | */ |
||
53 | 348 | public static function makeFromPrimitives(string $tag, string $operator, $key, $value, bool $noKey, bool $alterNext): RuleDTO |
|
54 | { |
||
55 | 348 | return new RuleDTO([ |
|
56 | 348 | 'tag' => $tag, |
|
57 | 348 | 'operator' => $operator, |
|
58 | 348 | 'key' => $key, |
|
59 | 348 | 'value' => $value, |
|
60 | 348 | 'noKey' => $noKey, |
|
61 | 348 | 'alterNext' => $alterNext, |
|
62 | ]); |
||
63 | } |
||
64 | |||
65 | 336 | public function getTag(): string |
|
66 | { |
||
67 | 336 | return $this->tag; |
|
68 | } |
||
69 | |||
70 | 111 | public function getOperator(): string |
|
71 | { |
||
72 | 111 | return $this->operator; |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return string|array|null |
||
77 | */ |
||
78 | 342 | public function getKey() |
|
79 | { |
||
80 | 342 | return $this->key; |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return string|array|null |
||
85 | */ |
||
86 | 123 | public function getValue() |
|
89 | } |
||
90 | |||
91 | 123 | public function isNoKey(): bool |
|
92 | { |
||
93 | 123 | return $this->noKey; |
|
94 | } |
||
95 | |||
96 | 333 | public function isAlterNext(): bool |
|
99 | } |
||
100 | } |
||
101 |