| 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 | /** |
||
| 76 | * @param bool $sort |
||
| 77 | * @return array[] |
||
| 78 | */ |
||
| 79 | 7 | public function getItems(bool $sort = true) : array |
|
| 89 | |||
| 90 | 1 | public function getFlatItems(bool $sort = true) : array |
|
| 103 | |||
| 104 | /** |
||
| 105 | * @return $this |
||
| 106 | */ |
||
| 107 | 1 | public function flush() |
|
| 112 | } |
||
| 113 |