| @@ 259-270 (lines=12) @@ | ||
| 256 | * @param mixed $offset The object primary key or array offset. |
|
| 257 | * @return mixed Returns the requested object or NULL if not in the collection. |
|
| 258 | */ |
|
| 259 | public function offsetGet($offset) |
|
| 260 | { |
|
| 261 | if (is_int($offset)) { |
|
| 262 | $offset = $this->resolveOffset($offset); |
|
| 263 | $objects = array_values($this->objects); |
|
| 264 | if (isset($objects[$offset])) { |
|
| 265 | return $objects[$offset]; |
|
| 266 | } |
|
| 267 | } |
|
| 268 | ||
| 269 | return $this->get($offset); |
|
| 270 | } |
|
| 271 | ||
| 272 | /** |
|
| 273 | * Alias of {@see CollectionInterface::set()}. |
|
| @@ 299-310 (lines=12) @@ | ||
| 296 | * @param mixed $offset The object primary key or array offset. |
|
| 297 | * @return void |
|
| 298 | */ |
|
| 299 | public function offsetUnset($offset) |
|
| 300 | { |
|
| 301 | if (is_int($offset)) { |
|
| 302 | $offset = $this->resolveOffset($offset); |
|
| 303 | $keys = array_keys($this->objects); |
|
| 304 | if (isset($keys[$offset])) { |
|
| 305 | $offset = $keys[$offset]; |
|
| 306 | } |
|
| 307 | } |
|
| 308 | ||
| 309 | $this->remove($offset); |
|
| 310 | } |
|
| 311 | ||
| 312 | /** |
|
| 313 | * Parse the array offset. |
|