Exemplo n.º 1
0
 private function popOperator()
 {
     $op = array_pop($this->operators);
     if ($op->type === '?') {
         $else = array_pop($this->operands);
         $colon = $op->colon;
         $then = $op->then;
         $condition = array_pop($this->operands);
         $this->operands[] = OperatorFactory::createTernaryOperatorNode($condition, $op, $then, $colon, $else);
     } elseif ($op->mode === Operator::MODE_UNARY) {
         $operand = array_pop($this->operands);
         $this->operands[] = OperatorFactory::createUnaryOperatorNode($op, $operand);
     } else {
         $right = array_pop($this->operands);
         $left = array_pop($this->operands);
         $this->operands[] = OperatorFactory::createBinaryOperatorNode($left, $op, $right);
     }
 }