/** * @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; }
/** * @param ExpressionNode $else * * @return $this */ public function setElse(ExpressionNode $else) { /** @var \Pharborist\Node $else */ $this->condition->replaceWith($else); return $this; }
/** * @param ExpressionNode $operand * @return $this */ public function setRightOperand(ExpressionNode $operand) { /** @var Node $operand */ $this->right->replaceWith($operand); return $this; }
/** * @param ExpressionNode $operand * @return $this */ public function setOperand(ExpressionNode $operand) { /** @var \Pharborist\Node $operand */ $this->operand->replaceWith($operand); return $this; }