Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | */ |
||
16 | class NotCondition implements NotConditionInterface |
||
17 | { |
||
18 | public function __construct(private mixed $condition) |
||
19 | { |
||
20 | } |
||
21 | |||
22 | public function getCondition(): mixed |
||
23 | { |
||
24 | return $this->condition; |
||
25 | } |
||
26 | |||
27 | public static function fromArrayDefinition(string $operator, array $operands): self |
||
28 | { |
||
29 | if (count($operands) !== 1) { |
||
30 | throw new InvalidArgumentException("Operator '$operator' requires exactly one operand."); |
||
31 | } |
||
32 | |||
33 | return new static(array_shift($operands)); |
||
34 | } |
||
35 | } |
||
36 |