Total Complexity | 7 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | abstract class AbstractInventory extends NetworkSerializable implements \Countable |
||
11 | { |
||
12 | /** |
||
13 | * @var Inventory[] |
||
14 | */ |
||
15 | private $items = []; |
||
16 | |||
17 | /** |
||
18 | 27 | * @param Inventory[] $vector |
|
19 | */ |
||
20 | 27 | public function __construct(array $vector) |
|
21 | 21 | { |
|
22 | 18 | foreach ($vector as $item) { |
|
23 | 27 | $this->addItem($item); |
|
24 | } |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | 21 | * @param Inventory $item |
|
29 | */ |
||
30 | 21 | private function addItem(Inventory $item) |
|
31 | 21 | { |
|
32 | $this->items[] = $item; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | 12 | * @return int |
|
37 | */ |
||
38 | 12 | public function count(): int |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | 21 | * @return Inventory[] |
|
45 | */ |
||
46 | 21 | public function getItems(): array |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @param int $index |
||
53 | 12 | * @return Inventory |
|
54 | */ |
||
55 | 12 | public function getItem(int $index): Inventory |
|
64 |