1 | <?php |
||
5 | abstract class AbstractCollection implements \IteratorAggregate, \Countable |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var mixed |
||
10 | */ |
||
11 | protected $class; |
||
12 | |||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $data = []; |
||
17 | |||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private $size = 0; |
||
22 | |||
23 | /** |
||
24 | * @param $object |
||
25 | */ |
||
26 | 23 | public function add($object) |
|
32 | |||
33 | /** |
||
34 | * @param int $position |
||
35 | * |
||
36 | * @return mixed |
||
37 | * @throws \LengthException |
||
38 | */ |
||
39 | 8 | public function pick(int $position) |
|
47 | |||
48 | /** |
||
49 | * @return int |
||
50 | */ |
||
51 | 6 | public function count() : int |
|
55 | |||
56 | /** |
||
57 | * @return Iterator |
||
58 | */ |
||
59 | 3 | public function getIterator() : Iterator |
|
63 | |||
64 | /** |
||
65 | * @param mixed $object |
||
66 | */ |
||
67 | 23 | private function validateObjectInstance($object) |
|
73 | } |
||
74 |