1 | <?php |
||
13 | trait PropertiesPart { |
||
14 | |||
15 | /** @var PhpProperty[] */ |
||
16 | private $properties = []; |
||
17 | |||
18 | /** |
||
19 | * Sets a collection of properties |
||
20 | * |
||
21 | * @param PhpProperty[] $properties |
||
22 | * @return $this |
||
23 | */ |
||
24 | 1 | public function setProperties(array $properties) { |
|
37 | |||
38 | /** |
||
39 | * Adds a property |
||
40 | * |
||
41 | * @param PhpProperty $property |
||
42 | * @return $this |
||
43 | */ |
||
44 | 14 | public function setProperty(PhpProperty $property) { |
|
50 | |||
51 | /** |
||
52 | * Removes a property |
||
53 | * |
||
54 | * @param PhpProperty|string $nameOrProperty property name or instance |
||
55 | * @throws \InvalidArgumentException If the property cannot be found |
||
56 | * @return $this |
||
57 | */ |
||
58 | 2 | public function removeProperty($nameOrProperty) { |
|
72 | |||
73 | /** |
||
74 | * Checks whether a property exists |
||
75 | * |
||
76 | * @param PhpProperty|string $nameOrProperty property name or instance |
||
77 | * @return bool `true` if a property exists and `false` if not |
||
78 | */ |
||
79 | 1 | public function hasProperty($nameOrProperty) { |
|
86 | |||
87 | /** |
||
88 | * Returns a property |
||
89 | * |
||
90 | * @param string $nameOrProperty property name |
||
91 | * @throws \InvalidArgumentException If the property cannot be found |
||
92 | * @return PhpProperty |
||
93 | */ |
||
94 | 4 | public function getProperty($nameOrProperty) { |
|
105 | |||
106 | /** |
||
107 | * Returns a collection of properties |
||
108 | * |
||
109 | * @return PhpProperty[] |
||
110 | */ |
||
111 | 13 | public function getProperties() { |
|
114 | |||
115 | /** |
||
116 | * Returns all property names |
||
117 | * |
||
118 | * @return string[] |
||
119 | */ |
||
120 | 1 | public function getPropertyNames() { |
|
123 | |||
124 | /** |
||
125 | * Clears all properties |
||
126 | * |
||
127 | * @return $this |
||
128 | */ |
||
129 | 1 | public function clearProperties() { |
|
137 | } |
||
138 |