1 | <?php |
||
49 | class PropertyList implements PropertyListInterface |
||
50 | { |
||
51 | /** |
||
52 | * Use iterator methods |
||
53 | */ |
||
54 | use PropertyListIteratorTrait; |
||
55 | |||
56 | /** |
||
57 | * Property values |
||
58 | * |
||
59 | * @var array[] |
||
60 | */ |
||
61 | protected $values = []; |
||
62 | /** |
||
63 | * Property names |
||
64 | * |
||
65 | * @var IriInterface[] |
||
66 | */ |
||
67 | protected $names = []; |
||
68 | /** |
||
69 | * Name cursor mapping |
||
70 | * |
||
71 | * @var int[] |
||
72 | */ |
||
73 | protected $nameToCursor = []; |
||
74 | /** |
||
75 | * Internal cursor |
||
76 | * |
||
77 | * @var int |
||
78 | */ |
||
79 | protected $cursor = 0; |
||
80 | |||
81 | /** |
||
82 | * Unset a property |
||
83 | * |
||
84 | * @param IriInterface|string $iri IRI |
||
85 | * @throws ErrorException |
||
86 | */ |
||
87 | 1 | public function offsetUnset($iri) |
|
95 | |||
96 | /** |
||
97 | * Return the number of properties |
||
98 | * |
||
99 | * @return int Number of properties |
||
100 | */ |
||
101 | 5 | public function count() |
|
105 | |||
106 | /** |
||
107 | * Return an array form |
||
108 | * |
||
109 | * @return array Array form |
||
110 | */ |
||
111 | 1 | public function toArray() |
|
121 | |||
122 | /** |
||
123 | * Add a property |
||
124 | * |
||
125 | * @param PropertyInterface $property Property |
||
126 | */ |
||
127 | 14 | public function add(PropertyInterface $property) |
|
140 | |||
141 | /** |
||
142 | * Return whether a property exists |
||
143 | * |
||
144 | * @param IriInterface|string $iri IRI |
||
145 | * @return boolean Property exists |
||
146 | */ |
||
147 | 14 | public function offsetExists($iri) |
|
151 | |||
152 | /** |
||
153 | * Set a particular property |
||
154 | * |
||
155 | * @param IriInterface|string $iri IRI |
||
156 | * @param array $value Property values |
||
157 | */ |
||
158 | 14 | public function offsetSet($iri, $value) |
|
166 | |||
167 | /** |
||
168 | * Get a particular property |
||
169 | * |
||
170 | * @param IriInterface|string $iri IRI |
||
171 | * @return array Property values |
||
172 | */ |
||
173 | 6 | public function &offsetGet($iri) |
|
188 | } |
||
189 |