Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/MemberExpression.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 a member expression.
14 * For example: foo.bar
15 *
16 * @author Marco Marchiò <[email protected]>
17 */
18 class MemberExpression extends ChainElement implements Pattern
19 {
20 /**
21 * Map of node properties
22 *
23 * @var array
24 */
25 protected $propertiesMap = array(
26 "object" => true,
27 "property" => true,
28 "computed" => false
29 );
30
31 /**
32 * Expression's object
33 *
34 * @var Expression|Super
35 */
36 protected $object;
37
38 /**
39 * Expression's property
40 *
41 * @var Expression|PrivateIdentifier
42 */
43 protected $property;
44
45 /**
46 * Computed flag that is true if the property is declared using square
47 * brackets syntax
48 *
49 * @var bool
50 */
51 protected $computed = false;
52
53 /**
54 * Returns the expression's object
55 *
56 * @return Expression|Super
57 */
58 public function getObject()
59 {
60 return $this->object;
61 }
62
63 /**
64 * Sets the expression's object
65 *
66 * @param Expression|Super $object Object
67 *
68 * @return $this
69 */
70 public function setObject($object)
71 {
72 $this->assertType($object, array("Expression", "Super"));
73 $this->object = $object;
74 return $this;
75 }
76
77 /**
78 * Returns the expression's property
79 *
80 * @return Expression|PrivateIdentifier
81 */
82 public function getProperty()
83 {
84 return $this->property;
85 }
86
87 /**
88 * Sets the expression's property
89 *
90 * @param Expression|PrivateIdentifier $property Property
91 *
92 * @return $this
93 */
94 public function setProperty($property)
95 {
96 $this->assertType($property, array("Expression", "PrivateIdentifier"));
97 $this->property = $property;
98 return $this;
99 }
100
101 /**
102 * Returns the computed flag that is true if the property is declared
103 * using square brackets syntax
104 *
105 * @return bool
106 */
107 public function getComputed()
108 {
109 return $this->computed;
110 }
111
112 /**
113 * Sets the computed flag that is true if the property is declared
114 * using square brackets syntax
115 *
116 * @param bool $computed Computed flag
117 *
118 * @return $this
119 */
120 public function setComputed($computed)
121 {
122 $this->computed = (bool) $computed;
123 return $this;
124 }
125 }