Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/AssignmentExpression.php

raw
1 <?php
2 /**
3 * This file is part of the Peast package
4 *
5 * (c) Marco Marchiò <[email protected]>
6 *
7 * For the full copyright and license information refer to the LICENSE file
8 * distributed with this source code
9 */
10 namespace Peast\Syntax\Node;
11
12 /**
13 * A node that represents an assignment expression.
14 * For example: a = b
15 *
16 * @author Marco Marchiò <[email protected]>
17 */
18 class AssignmentExpression extends Node implements Expression
19 {
20 /**
21 * Map of node properties
22 *
23 * @var array
24 */
25 protected $propertiesMap = array(
26 "left" => true,
27 "operator" => false,
28 "right" => true
29 );
30
31 /**
32 * The assignment operator
33 *
34 * @var string
35 */
36 protected $operator;
37
38 /**
39 * The left node of the assignment
40 *
41 * @var Pattern|Expression
42 */
43 protected $left;
44
45 /**
46 * The right node of the assignment
47 *
48 * @var Expression
49 */
50 protected $right;
51
52 /**
53 * Returns the assignment operator
54 *
55 * @return string
56 */
57 public function getOperator()
58 {
59 return $this->operator;
60 }
61
62 /**
63 * Sets the assignment operator
64 *
65 * @param string $operator Assignment operator
66 *
67 * @return $this
68 */
69 public function setOperator($operator)
70 {
71 $this->operator = $operator;
72 return $this;
73 }
74
75 /**
76 * Returns the left node of the assignment
77 *
78 * @return Pattern|Expression
79 */
80 public function getLeft()
81 {
82 return $this->left;
83 }
84
85 /**
86 * Sets the left node of the assignment
87 *
88 * @param Pattern|Expression $left The node to set
89 *
90 * @return $this
91 */
92 public function setLeft($left)
93 {
94 $this->assertType($left, array("Pattern", "Expression"));
95 $this->left = $left;
96 return $this;
97 }
98
99 /**
100 * Returns the right node of the assignment
101 *
102 * @return Expression
103 */
104 public function getRight()
105 {
106 return $this->right;
107 }
108
109 /**
110 * Sets the right node of the assignment
111 *
112 * @param Expression $right The node to set
113 *
114 * @return $this
115 */
116 public function setRight(Expression $right)
117 {
118 $this->right = $right;
119 return $this;
120 }
121 }