Total Complexity | 11 |
Total Lines | 84 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | abstract class AbstractConnective extends AbstractNode implements Connective |
||
11 | { |
||
12 | /** @var Node[] */ |
||
13 | protected array $nodes; |
||
14 | |||
15 | /** |
||
16 | * Logical conjunction (AND). |
||
17 | * |
||
18 | * @param Node[] $nodes |
||
19 | * @param Node|null $parent |
||
20 | */ |
||
21 | public function __construct(array $nodes, ?Node $parent = null) |
||
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @inheritDoc |
||
34 | */ |
||
35 | public function getNodes(): array |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @inheritDoc |
||
42 | */ |
||
43 | public function offsetExists($offset): bool |
||
44 | { |
||
45 | if (is_int($offset) === false) { |
||
46 | throw new \InvalidArgumentException('Expected numeric offset.'); |
||
47 | } |
||
48 | |||
49 | return isset($this->nodes[$offset]); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @inheritDoc |
||
54 | */ |
||
55 | public function offsetGet($offset): mixed |
||
56 | { |
||
57 | if (is_int($offset) === false) { |
||
58 | throw new \InvalidArgumentException('Expected numeric offset.'); |
||
59 | } |
||
60 | |||
61 | return $this->nodes[$offset]; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @inheritDoc |
||
66 | */ |
||
67 | public function offsetSet($offset, $value): void |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @inheritDoc |
||
74 | */ |
||
75 | public function offsetUnset($offset): void |
||
76 | { |
||
77 | throw new \LogicException('Conjunction is read-only.'); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @inheritDoc |
||
82 | */ |
||
83 | public function count(): int |
||
84 | { |
||
85 | return count($this->nodes); |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @inheritDoc |
||
90 | */ |
||
91 | public function getIterator(): \Traversable |
||
94 | } |
||
95 | } |
||
96 |