Total Complexity | 9 |
Total Lines | 76 |
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) |
||
22 | { |
||
23 | parent::__construct($parent); |
||
24 | |||
25 | $this->nodes = $nodes; |
||
26 | |||
27 | foreach ($this->nodes as $node) { |
||
28 | $node->setParent($this); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @inheritDoc |
||
34 | */ |
||
35 | public function getNodes(): array |
||
36 | { |
||
37 | return $this->nodes; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @inheritDoc |
||
42 | */ |
||
43 | public function offsetExists($offset) |
||
44 | { |
||
45 | return isset($this->nodes[$offset]); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @inheritDoc |
||
50 | */ |
||
51 | public function offsetGet($offset) |
||
52 | { |
||
53 | return $this->nodes[$offset]; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @inheritDoc |
||
58 | */ |
||
59 | public function offsetSet($offset, $value) |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @inheritDoc |
||
66 | */ |
||
67 | public function offsetUnset($offset) |
||
68 | { |
||
69 | throw new \LogicException('Conjunction is read-only.'); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @inheritDoc |
||
74 | */ |
||
75 | public function count() |
||
76 | { |
||
77 | return count($this->nodes); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @inheritDoc |
||
82 | */ |
||
83 | public function getIterator() |
||
86 | } |
||
87 | } |
||
88 |