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. Note that existing |
||
26 | * indexes are removed. If indexes are significant, use KeyedCollection |
||
27 | * instead. |
||
28 | * |
||
29 | */ |
||
30 | public function __construct(array $data = []) |
||
34 | |||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | * |
||
39 | */ |
||
40 | public static function fromCollection(CollectionInterface $collection) |
||
44 | |||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | * |
||
49 | */ |
||
50 | public function has($item) |
||
54 | |||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | * |
||
59 | */ |
||
60 | public function getWhere(callable $callable) |
||
68 | |||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | * |
||
73 | */ |
||
74 | public function getAtIndex($index) |
||
82 | |||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | * |
||
87 | */ |
||
88 | public function isEmpty() |
||
92 | |||
93 | |||
94 | /** |
||
95 | * Returns the number of items within the collection. |
||
96 | * |
||
97 | * @return int |
||
98 | * |
||
99 | */ |
||
100 | public function count() |
||
104 | |||
105 | |||
106 | /** |
||
107 | * Returns an iterator. |
||
108 | * |
||
109 | * @return \Traversable |
||
110 | * |
||
111 | */ |
||
112 | public function getIterator() |
||
116 | |||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | * |
||
121 | */ |
||
122 | public function toArray() |
||
126 | |||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | * |
||
131 | */ |
||
132 | public function filter(callable $callable) |
||
137 | |||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | * |
||
142 | */ |
||
143 | public function map(callable $callable) |
||
147 | } |
||
148 |