ILIAS  release_7 Revision v7.30-3-g800a261c036
AbstractCollection.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use Iterator;
24
29abstract class AbstractCollection
30{
34 protected $items = [];
35
40
44 public function __construct(string $resource_version)
45 {
46 $this->resource_version = $resource_version;
47 }
48
49 public function clear() : void
50 {
51 $this->items = [];
52 }
53
57 public function getItems() : Iterator
58 {
59 yield from $this->items;
60 }
61
65 public function getItemsInOrderOfDelivery() : array
66 {
67 return $this->items;
68 }
69
74 protected function stripPath(string $path) : string
75 {
76 if (strpos($path, '?') !== false) {
77 return parse_url($path, PHP_URL_PATH);
78 }
79
80 return $path;
81 }
82}
An exception for terminatinating execution or to throw for unit testing.