Ejemplo n.º 1
0
 /**
  * @param ExpressionNode|NULL $node
  * @return $this
  */
 public function setValue($node)
 {
     if ($node === NULL) {
         if (isset($this->value)) {
             $this->value->previousUntil(Filter::isInstanceOf('\\Pharborist\\Variables\\VariableNode'))->remove();
             $this->value->remove();
         }
     } else {
         if (isset($this->value)) {
             /** @var Node $node */
             $this->value->replaceWith($node);
         } else {
             $this->append([Token::space(), Token::assign(), Token::space(), $node]);
         }
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * @param ExpressionNode $else
  *
  * @return $this
  */
 public function setElse(ExpressionNode $else)
 {
     /** @var \Pharborist\Node $else */
     $this->condition->replaceWith($else);
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * @param ExpressionNode $operand
  * @return $this
  */
 public function setRightOperand(ExpressionNode $operand)
 {
     /** @var Node $operand */
     $this->right->replaceWith($operand);
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * @param ExpressionNode $operand
  * @return $this
  */
 public function setOperand(ExpressionNode $operand)
 {
     /** @var \Pharborist\Node $operand */
     $this->operand->replaceWith($operand);
     return $this;
 }