1 | <?php |
||
5 | class Collection implements CollectionInterface |
||
6 | { |
||
7 | /** @var array */ |
||
8 | protected $items = []; |
||
9 | |||
10 | /** |
||
11 | * @param string $name |
||
12 | * @param mixed $item |
||
13 | * @param int $priority |
||
14 | * |
||
15 | * @return $this |
||
16 | * |
||
17 | * @throws DuplicateKeyException |
||
18 | */ |
||
19 | 8 | public function addItem(string $name, $item, int $priority = 50) |
|
28 | |||
29 | /** |
||
30 | * @param string $name |
||
31 | * @param null|int $priority |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | 2 | public function removeItem(string $name, int $priority = null) |
|
47 | |||
48 | /** |
||
49 | * @param string $name |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | 1 | protected function removeItemWithoutPriority(string $name) |
|
63 | |||
64 | 8 | public function has(string $name) : bool |
|
74 | |||
75 | 7 | public function getItems() : array |
|
79 | |||
80 | 2 | public function getSortedItems() : array |
|
87 | |||
88 | 1 | public function getFlatSortedItems() : array |
|
102 | |||
103 | /** |
||
104 | * @return $this |
||
105 | */ |
||
106 | 1 | public function flush() |
|
111 | } |
||
112 |