| @@ 170-181 (lines=12) @@ | ||
| 167 | * |
|
| 168 | * @return string |
|
| 169 | */ |
|
| 170 | public function onLogicalExpression($expressionType, $left, $right) |
|
| 171 | { |
|
| 172 | $type = $this->unpackExpressionType($expressionType); |
|
| 173 | switch ($type) { |
|
| 174 | case ExpressionType::AND_LOGICAL: |
|
| 175 | return $this->prepareBinaryExpression(self::LOGICAL_AND, $left, $right); |
|
| 176 | case ExpressionType::OR_LOGICAL: |
|
| 177 | return $this->prepareBinaryExpression(self::LOGICAL_OR, $left, $right); |
|
| 178 | default: |
|
| 179 | throw new \InvalidArgumentException('onLogicalExpression'); |
|
| 180 | } |
|
| 181 | } |
|
| 182 | /** |
|
| 183 | * Call-back for arithmetic expression. |
|
| 184 | * |
|
| @@ 246-257 (lines=12) @@ | ||
| 243 | * |
|
| 244 | * @return string |
|
| 245 | */ |
|
| 246 | public function onUnaryExpression($expressionType, $child) |
|
| 247 | { |
|
| 248 | $type = $this->unpackExpressionType($expressionType); |
|
| 249 | switch ($type) { |
|
| 250 | case ExpressionType::NEGATE: |
|
| 251 | return $this->prepareUnaryExpression(self::NEGATE, $child); |
|
| 252 | case ExpressionType::NOT_LOGICAL: |
|
| 253 | return $this->prepareUnaryExpression(self::LOGICAL_NOT, $child); |
|
| 254 | default: |
|
| 255 | throw new \InvalidArgumentException('onUnaryExpression'); |
|
| 256 | } |
|
| 257 | } |
|
| 258 | /** |
|
| 259 | * Call-back for constant expression. |
|
| 260 | * |
|