1 | <?php |
||
49 | class PropertyList implements PropertyListInterface |
||
50 | { |
||
51 | /** |
||
52 | * Property values |
||
53 | * |
||
54 | * @var array[] |
||
55 | */ |
||
56 | protected $values = []; |
||
57 | /** |
||
58 | * Property names |
||
59 | * |
||
60 | * @var \stdClass[] |
||
61 | */ |
||
62 | protected $names = []; |
||
63 | /** |
||
64 | * Name cursor mapping |
||
65 | * |
||
66 | * @var int[] |
||
67 | */ |
||
68 | protected $nameToCursor = []; |
||
69 | /** |
||
70 | * Internal cursor |
||
71 | * |
||
72 | * @var int |
||
73 | */ |
||
74 | protected $cursor = 0; |
||
75 | |||
76 | /** |
||
77 | * Unset a property |
||
78 | * |
||
79 | * @param \stdClass|string $iri IRI |
||
80 | * @throws ErrorException |
||
81 | */ |
||
82 | 1 | public function offsetUnset($iri) |
|
90 | |||
91 | /** |
||
92 | * Return the number of properties |
||
93 | * |
||
94 | * @return int Number of properties |
||
95 | */ |
||
96 | 2 | public function count() |
|
100 | |||
101 | /** |
||
102 | * Return the current property values |
||
103 | * |
||
104 | * @return array Property values |
||
105 | */ |
||
106 | 8 | public function current() |
|
110 | |||
111 | /** |
||
112 | * Move forward to next element |
||
113 | */ |
||
114 | 8 | public function next() |
|
118 | |||
119 | /** |
||
120 | * Return the current IRI key |
||
121 | * |
||
122 | * @return \stdClass IRI key |
||
123 | */ |
||
124 | 8 | public function key() |
|
128 | |||
129 | /** |
||
130 | * Checks if current position is valid |
||
131 | * |
||
132 | * @return boolean The current position is valid |
||
133 | */ |
||
134 | 17 | public function valid() |
|
138 | |||
139 | /** |
||
140 | * Rewind the Iterator to the first element |
||
141 | */ |
||
142 | 17 | public function rewind() |
|
146 | |||
147 | /** |
||
148 | * Add a property |
||
149 | * |
||
150 | * @param \stdClass|Iri $property Property |
||
151 | */ |
||
152 | 37 | public function add($property) |
|
166 | |||
167 | /** |
||
168 | * Return whether a property exists |
||
169 | * |
||
170 | * @param \stdClass|Iri|string $iri IRI |
||
171 | * @return boolean Property exists |
||
172 | */ |
||
173 | 37 | public function offsetExists($iri) |
|
184 | |||
185 | /** |
||
186 | * Get a particular property cursor by its profiled name |
||
187 | * |
||
188 | * @param Iri $iri IRI |
||
189 | * @return int Property cursor |
||
190 | * @throws OutOfBoundsException If the property name is unknown |
||
191 | */ |
||
192 | 31 | protected function getProfiledPropertyCursor($iri) |
|
203 | |||
204 | /** |
||
205 | * Handle an unknown property name |
||
206 | * |
||
207 | * @param string $name Property name |
||
208 | * @throws OutOfBoundsException If the property name is unknown |
||
209 | */ |
||
210 | 40 | protected function handleUnknownName($name) |
|
217 | |||
218 | /** |
||
219 | * Get a particular property cursor by its name |
||
220 | * |
||
221 | * @param string $name Property name |
||
222 | * @return int Property cursor |
||
223 | */ |
||
224 | 10 | protected function getPropertyCursor($name) |
|
235 | |||
236 | /** |
||
237 | * Set a particular property |
||
238 | * |
||
239 | * @param \stdClass|Iri|string $iri IRI |
||
240 | * @param array $value Property values |
||
241 | */ |
||
242 | 9 | public function offsetSet($iri, $value) |
|
251 | |||
252 | /** |
||
253 | * Get a particular property |
||
254 | * |
||
255 | * @param \stdClass|Iri|string $iri IRI |
||
256 | * @return array Property values |
||
257 | * @throws OutOfBoundsException If the property name is unknown |
||
258 | */ |
||
259 | 15 | public function &offsetGet($iri) |
|
266 | } |
||
267 |