1 | <?php |
||
22 | abstract class Collection implements \Countable |
||
23 | { |
||
24 | /** |
||
25 | * Collection elements |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $collection = array(); |
||
30 | |||
31 | /** |
||
32 | * Return value for given offset |
||
33 | * |
||
34 | * @param string $offset |
||
35 | * |
||
36 | * @return mixed |
||
37 | * @throws OutOfRangeException |
||
38 | */ |
||
39 | 15 | public function get($offset) |
|
47 | |||
48 | /** |
||
49 | * Check if there is element for offset |
||
50 | * |
||
51 | * @param string $offset |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | 21 | public function has($offset): bool |
|
59 | |||
60 | /** |
||
61 | * Return all elements in collection |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | 4 | public function all(): array |
|
69 | |||
70 | /** |
||
71 | * Count elements of an object |
||
72 | * |
||
73 | * @return int |
||
74 | */ |
||
75 | 2 | public function count(): int |
|
79 | } |
||
80 |