44
55use Collections \Immutable \ImmVector ;
66
7- interface Iterable extends \IteratorAggregate
7+ interface Enumerable extends \IteratorAggregate
88{
99 /**
10- * Returns an array converted from the current Iterable .
11- * @return array - an array converted from the current Iterable .
10+ * Returns an array converted from the current Enumerable .
11+ * @return array - an array converted from the current Enumerable .
1212 */
1313 public function toArray ();
1414
1515 /**
16- * Returns an array with the values from the current Iterable .
17- * The keys in the current Iterable are discarded and replaced with integer indices, starting with 0.
18- * @return array - an array containing the values from the current Iterable .
16+ * Returns an array with the values from the current Enumerable .
17+ * The keys in the current Enumerable are discarded and replaced with integer indices, starting with 0.
18+ * @return array - an array containing the values from the current Enumerable .
1919 */
2020 public function toValuesArray ();
2121
2222 /**
23- * Returns a Vector converted from the current Iterable .
24- * Any keys in the current Iterable are discarded and replaced with integer indices, starting with 0.
25- * @return VectorInterface - a Vector converted from the current Iterable .
23+ * Returns a Vector converted from the current Enumerable .
24+ * Any keys in the current Enumerable are discarded and replaced with integer indices, starting with 0.
25+ * @return VectorInterface - a Vector converted from the current Enumerable .
2626 */
2727 public function toVector ();
2828
2929 /**
30- * Returns an immutable vector (`ImmVector`) converted from the current `Iterable `.
31- * Any keys in the current `Iterable ` are discarded and replaced with integer indices, starting with 0.
32- * @return ImmVector - an `ImmVector` converted from the current `Iterable `.
30+ * Returns an immutable vector (`ImmVector`) converted from the current `Enumerable `.
31+ * Any keys in the current `Enumerable ` are discarded and replaced with integer indices, starting with 0.
32+ * @return ImmVector - an `ImmVector` converted from the current `Enumerable `.
3333 */
3434 public function toImmVector ();
3535
3636 /**
37- * Returns a `Set` converted from the current `Iterable `.
38- * Any keys in the current `Iterable ` are discarded.
39- * @return SetInterface - a `Set` converted from the current `Iterable `.
37+ * Returns a `Set` converted from the current `Enumerable `.
38+ * Any keys in the current `Enumerable ` are discarded.
39+ * @return SetInterface - a `Set` converted from the current `Enumerable `.
4040 */
4141 public function toSet ();
4242
4343 /**
44- * Returns an immutable set (`ImmSet`) converted from the current `Iterable `.
45- * Any keys in the current `Iterable ` are discarded.
44+ * Returns an immutable set (`ImmSet`) converted from the current `Enumerable `.
45+ * Any keys in the current `Enumerable ` are discarded.
4646 *
47- * @return ConstSetInterface - an `ImmSet` converted from the current `Iterable `.
47+ * @return ConstSetInterface - an `ImmSet` converted from the current `Enumerable `.
4848 */
4949 public function toImmSet ();
5050
5151 /**
52- * Returns an `Iterable ` containing the current `Iterable `'s values.
52+ * Returns an `Enumerable ` containing the current `Enumerable `'s values.
5353 * Any keys are discarded.
5454 *
55- * @return Iterable - An `Iterable ` with the values of the current `Iterable `.
55+ * @return Enumerable - An `Enumerable ` with the values of the current `Enumerable `.
5656 */
5757 public function values ();
5858
@@ -63,28 +63,28 @@ public function values();
6363 *
6464 * @param callable $fn - A callable function that will receive each of the elements
6565 * in this collection
66- * @return Iterable - The same `Iterable ` instance.
66+ * @return Enumerable - The same `Enumerable ` instance.
6767 */
6868 public function each (callable $ fn );
6969
7070 /**
71- * Returns an `Iterable ` containing the values after an operation has been
72- * applied to each value in the current `Iterable `.
71+ * Returns an `Enumerable ` containing the values after an operation has been
72+ * applied to each value in the current `Enumerable `.
7373 *
74- * Every value in the current `Iterable ` is affected by a call to `map()`,
74+ * Every value in the current `Enumerable ` is affected by a call to `map()`,
7575 * unlike `filter()` where only values that meet a certain criteria are
7676 * affected.
7777 *
7878 * @param $fn - The callback containing the operation to apply to the
79- * `Iterable ` values.
79+ * `Enumerable ` values.
8080 *
81- * @return Iterable - an `Iterable ` containing the values after a user-specified
81+ * @return Enumerable - an `Enumerable ` containing the values after a user-specified
8282 * operation is applied.
8383 */
8484 public function map (callable $ fn );
8585
8686 /**
87- * Returns an `Iterable ` containing the values of the current `Iterable ` that
87+ * Returns an `Enumerable ` containing the values of the current `Enumerable ` that
8888 * meet a supplied condition.
8989 *
9090 * Only values that meet a certain criteria are affected by a call to
@@ -93,135 +93,135 @@ public function map(callable $fn);
9393 * @param $fn - The callback containing the condition to apply to the
9494 * `Itearble` values.
9595 *
96- * @return Iterable - an `Iterable ` containing the values after a user-specified
96+ * @return Enumerable - an `Enumerable ` containing the values after a user-specified
9797 * condition is applied.
9898 */
9999 public function filter (callable $ fn );
100100
101101 /**
102- * Returns an `Iterable ` containing the first `n` values of the current
103- * `Iterable `.
102+ * Returns an `Enumerable ` containing the first `n` values of the current
103+ * `Enumerable `.
104104 *
105- * The returned `Iterable ` will always be a proper subset of the current
106- * `Iterable `.
105+ * The returned `Enumerable ` will always be a proper subset of the current
106+ * `Enumerable `.
107107 *
108108 * `$n` is 1-based. So the first element is 1, the second 2, etc.
109109 *
110110 * @param $size - The last element that will be included in the returned
111- * `Iterable `.
111+ * `Enumerable `.
112112 *
113- * @return Iterable - An `Iterable that is a proper subset of the current `Iterable `
113+ * @return Enumerable - An `Enumerable that is a proper subset of the current `Enumerable `
114114 * up to `n` elements.
115115 */
116116 public function take ($ size = 1 );
117117
118118 /**
119- * Returns an `Iterable ` containing the values after the `n`-th element of the
120- * current `Iterable `.
119+ * Returns an `Enumerable ` containing the values after the `n`-th element of the
120+ * current `Enumerable `.
121121 *
122- * The returned `Iterable ` will always be a proper subset of the current
123- * `Iterable `.
122+ * The returned `Enumerable ` will always be a proper subset of the current
123+ * `Enumerable `.
124124 *
125125 * `$n` is 1-based. So the first element is 1, the second 2, etc.
126126 *
127127 * @param $n - The last element to be skipped; the `$n+1` element will be
128- * the first one in the returned `Iterable `.
128+ * the first one in the returned `Enumerable `.
129129 *
130- * @return Iterable - An `Iterable ` that is a proper subset of the current `Iterable `
130+ * @return Enumerable - An `Enumerable ` that is a proper subset of the current `Enumerable `
131131 * containing values after the specified `n`-th element.
132132 */
133133 public function skip ($ n );
134134
135135 /**
136- * Returns a subset of the current `Iterable ` starting from a given key up
136+ * Returns a subset of the current `Enumerable ` starting from a given key up
137137 * to, but not including, the element at the provided length from the
138138 * starting key.
139139 *
140140 * `$start` is 0-based. `$len` is 1-based. So `slice(0, 2)` would return the
141141 * elements at key 0 and 1.
142142 *
143- * The returned `Iterable ` will always be a proper subset of the current
144- * `Iterable `.
143+ * The returned `Enumerable ` will always be a proper subset of the current
144+ * `Enumerable `.
145145 *
146- * @param $start - The starting key of the current `Iterable ` to begin the
147- * returned `Iterable `.
148- * @param $length - The length of the returned `Iterable `.
146+ * @param $start - The starting key of the current `Enumerable ` to begin the
147+ * returned `Enumerable `.
148+ * @param $length - The length of the returned `Enumerable `.
149149 *
150- * @return Iterable - An `Iterable ` that is a proper subset of the current `Iterable `
150+ * @return Enumerable - An `Enumerable ` that is a proper subset of the current `Enumerable `
151151 * starting at `$start` up to but not including the element
152152 * `$start + $len`.
153153 */
154154 public function slice ($ start , $ length );
155155
156156 /**
157- * Returns an `Iterable ` that is the concatenation of the values of the current `Iterable `
157+ * Returns an `Enumerable ` that is the concatenation of the values of the current `Enumerable `
158158 * and the values of the provided `Traversable`.
159159 *
160- * The values of the provided `Traversable` is concatenated to the end of the current `Iterable `
161- * to produce the returned `Iterable `.
160+ * The values of the provided `Traversable` is concatenated to the end of the current `Enumerable `
161+ * to produce the returned `Enumerable `.
162162 *
163- * @param \Traversable|array $traversable - The `Traversable` to concatenate to the current `Iterable `.
164- * @return Iterable - The concatenated `Iterable `.
163+ * @param \Traversable|array $traversable - The `Traversable` to concatenate to the current `Enumerable `.
164+ * @return Enumerable - The concatenated `Enumerable `.
165165 */
166166 public function concat ($ traversable );
167167
168168 /**
169- * Returns the first value in the current `Iterable `.
169+ * Returns the first value in the current `Enumerable `.
170170 *
171- * @return mixed - The first value in the current `Iterable `, or `null` if the
172- * current `Iterable ` is empty.
171+ * @return mixed - The first value in the current `Enumerable `, or `null` if the
172+ * current `Enumerable ` is empty.
173173 */
174174 public function first ();
175175
176176 /**
177- * Returns the last value in the current `Iterable `.
177+ * Returns the last value in the current `Enumerable `.
178178 *
179- * @return mixed - The last value in the current `Iterable `, or `null` if the
180- * current `Iterable ` is empty.
179+ * @return mixed - The last value in the current `Enumerable `, or `null` if the
180+ * current `Enumerable ` is empty.
181181 */
182182 public function last ();
183183
184184 /**
185185 * Returns a `ConstVector` where each element is a `Pair` that combines the
186186 * element of the current `ConstVector` and the provided `Traversable`.
187187 *
188- * If the number of elements of the `Iterable ` are not equal to the
188+ * If the number of elements of the `Enumerable ` are not equal to the
189189 * number of elements in the `Traversable`, then only the combined elements
190190 * up to and including the final element of the one with the least number of
191191 * elements is included.
192192 *
193193 * @param $traversable - The `Traversable` to use to combine with the
194- * elements of this `Iterable `.
194+ * elements of this `Enumerable `.
195195 *
196- * @return - The `Iterable ` that combines the values of the current
197- * `Iterable ` with the provided `Traversable`.
196+ * @return - The `Enumerable ` that combines the values of the current
197+ * `Enumerable ` with the provided `Traversable`.
198198 */
199199 public function zip ($ traversable );
200200
201201 /**
202202 * Groups the collection based on a given criteria
203203 * @param $callback
204- * @return Iterable
204+ * @return Enumerable
205205 */
206206 public function groupBy ($ callback );
207207
208208 /**
209209 * Indexes the collection based on a given criteria
210210 * @param $callback
211- * @return Iterable
211+ * @return Enumerable
212212 */
213213 public function indexBy ($ callback );
214214
215215 /**
216216 * Verifies if an element exists in the collection for a given criteria
217217 * @param callable $fn
218- * @return Iterable
218+ * @return Enumerable
219219 */
220220 public function exists (callable $ fn );
221221
222222 /**
223223 * Flatten the collection into one dimension
224- * @return Iterable
224+ * @return Enumerable
225225 */
226226 public function concatAll ();
227227}
0 commit comments