1: <?php
2: namespace Pharborist\Operators;
3:
4: use Pharborist\ExpressionNode;
5: use Pharborist\ParentNode;
6: use Pharborist\TokenNode;
7:
8:
9: /**
10: * An unary operation.
11: */
12: abstract class UnaryOperationNode extends ParentNode implements ExpressionNode {
13: /**
14: * @var TokenNode
15: */
16: protected $operator;
17:
18: /**
19: * @var ExpressionNode
20: */
21: protected $operand;
22:
23: /**
24: * @return TokenNode
25: */
26: public function getOperator() {
27: return $this->operator;
28: }
29:
30: /**
31: * @return ExpressionNode
32: */
33: public function getOperand() {
34: return $this->operand;
35: }
36:
37: /**
38: * @param ExpressionNode $operand
39: * @return $this
40: */
41: public function setOperand(ExpressionNode $operand) {
42: /** @var \Pharborist\Node $operand */
43: $this->operand->replaceWith($operand);
44: return $this;
45: }
46: }
47: