1 | <?php |
||
10 | class Collection implements CollectionInterface |
||
11 | { |
||
12 | /** |
||
13 | * The data in the collection. |
||
14 | * |
||
15 | * @var array |
||
16 | * |
||
17 | */ |
||
18 | protected $data = []; |
||
19 | |||
20 | |||
21 | /** |
||
22 | * Constructor |
||
23 | * |
||
24 | * @param array $data |
||
25 | * An array of data to populate the collection with. |
||
26 | * |
||
27 | */ |
||
28 | public function __construct(array $data = []) |
||
32 | |||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | * |
||
37 | */ |
||
38 | public function has($item) |
||
42 | |||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | * |
||
47 | */ |
||
48 | public function getWhere(callable $callable) |
||
56 | |||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | * |
||
61 | */ |
||
62 | public function isEmpty() |
||
66 | |||
67 | |||
68 | /** |
||
69 | * Returns the number of items within the collection. |
||
70 | * |
||
71 | * @return int |
||
72 | * |
||
73 | */ |
||
74 | public function count() |
||
78 | |||
79 | |||
80 | /** |
||
81 | * Returns an iterator. |
||
82 | * |
||
83 | * @return \Traversable |
||
84 | * |
||
85 | */ |
||
86 | public function getIterator() |
||
90 | |||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | * |
||
95 | */ |
||
96 | public function toArray() |
||
100 | |||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | * |
||
105 | */ |
||
106 | public function filter(callable $callable) |
||
111 | |||
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | * |
||
116 | */ |
||
117 | public function map(callable $callable) |
||
121 | } |
||
122 |