| @@ 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. |
|
| @@ 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 | ||
| @@ 182-201 (lines=20) @@ | ||
| 179 | * |
|
| 180 | * @param VisitorInterface $visitor |
|
| 181 | */ |
|
| 182 | public function walk(VisitorInterface $visitor) |
|
| 183 | { |
|
| 184 | $node = $this; |
|
| 185 | $result = $visitor->enterNode($node); |
|
| 186 | if ($result instanceof NodeInterface) { |
|
| 187 | $node = $result; |
|
| 188 | } |
|
| 189 | if ($result !== NodeTraverser::DONT_TRAVERSE_CHILDREN) { |
|
| 190 | foreach ($this->subTree as $key => $operand) { |
|
| 191 | $result2 = $operand->walk($visitor); |
|
| 192 | if ($result2 === NodeTraverser::REMOVE_NODE) { |
|
| 193 | unset($this->subTree[$key]); |
|
| 194 | } elseif ($result2 instanceof NodeInterface) { |
|
| 195 | $this->subTree[$key] = $result2; |
|
| 196 | } |
|
| 197 | } |
|
| 198 | } |
|
| 199 | ||
| 200 | return $visitor->leaveNode($node); |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||