| @@ 84-103 (lines=20) @@ | ||
| 81 | * |
|
| 82 | * @param VisitorInterface $visitor |
|
| 83 | */ |
|
| 84 | public function walk(VisitorInterface $visitor) |
|
| 85 | { |
|
| 86 | $node = $this; |
|
| 87 | $result = $visitor->enterNode($node); |
|
| 88 | if ($result instanceof NodeInterface) { |
|
| 89 | $node = $result; |
|
| 90 | } |
|
| 91 | if ($result !== NodeTraverser::DONT_TRAVERSE_CHILDREN) { |
|
| 92 | foreach ($this->operands as $key => $operand) { |
|
| 93 | $result2 = $operand->walk($visitor); |
|
| 94 | if ($result2 === NodeTraverser::REMOVE_NODE) { |
|
| 95 | unset($this->operands[$key]); |
|
| 96 | } elseif ($result2 instanceof NodeInterface) { |
|
| 97 | $this->operands[$key] = $result2; |
|
| 98 | } |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | return $visitor->leaveNode($node); |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Returns the symbol for this operator. |
|
| @@ 160-179 (lines=20) @@ | ||
| 157 | * |
|
| 158 | * @param VisitorInterface $visitor |
|
| 159 | */ |
|
| 160 | public function walk(VisitorInterface $visitor) |
|
| 161 | { |
|
| 162 | $node = $this; |
|
| 163 | $result = $visitor->enterNode($node); |
|
| 164 | if ($result instanceof NodeInterface) { |
|
| 165 | $node = $result; |
|
| 166 | } |
|
| 167 | if ($result !== NodeTraverser::DONT_TRAVERSE_CHILDREN) { |
|
| 168 | foreach ($this->subTree as $key => $operand) { |
|
| 169 | $result2 = $operand->walk($visitor); |
|
| 170 | if ($result2 === NodeTraverser::REMOVE_NODE) { |
|
| 171 | unset($this->subTree[$key]); |
|
| 172 | } elseif ($result2 instanceof NodeInterface) { |
|
| 173 | $this->subTree[$key] = $result2; |
|
| 174 | } |
|
| 175 | } |
|
| 176 | } |
|
| 177 | ||
| 178 | return $visitor->leaveNode($node); |
|
| 179 | } |
|
| 180 | } |
|
| 181 | ||
| @@ 194-213 (lines=20) @@ | ||
| 191 | * |
|
| 192 | * @param VisitorInterface $visitor |
|
| 193 | */ |
|
| 194 | public function walk(VisitorInterface $visitor) |
|
| 195 | { |
|
| 196 | $node = $this; |
|
| 197 | $result = $visitor->enterNode($node); |
|
| 198 | if ($result instanceof NodeInterface) { |
|
| 199 | $node = $result; |
|
| 200 | } |
|
| 201 | if ($result !== NodeTraverser::DONT_TRAVERSE_CHILDREN) { |
|
| 202 | foreach ($this->subTree as $key => $operand) { |
|
| 203 | $result2 = $operand->walk($visitor); |
|
| 204 | if ($result2 === NodeTraverser::REMOVE_NODE) { |
|
| 205 | unset($this->subTree[$key]); |
|
| 206 | } elseif ($result2 instanceof NodeInterface) { |
|
| 207 | $this->subTree[$key] = $result2; |
|
| 208 | } |
|
| 209 | } |
|
| 210 | } |
|
| 211 | ||
| 212 | return $visitor->leaveNode($node); |
|
| 213 | } |
|
| 214 | } |
|
| 215 | ||