File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 44
55 /**
66 * Check wether or not a variable is iterable (i.e array or \Traversable)
7- * @param array|\Traversable $iterable
7+ *
8+ * @param array|\Traversable $iterable
89 * @return bool
910 */
1011 function is_iterable ($ iterable )
@@ -17,7 +18,8 @@ function is_iterable($iterable)
1718
1819 /**
1920 * Copy the iterable into an array. If the iterable is already an array, return it.
20- * @param array|\Traversable $iterable
21+ *
22+ * @param array|\Traversable $iterable
2123 * @return array
2224 */
2325 function iterable_to_array ($ iterable )
@@ -27,6 +29,13 @@ function iterable_to_array($iterable)
2729}
2830
2931if (!function_exists ('iterable_to_traversable ' )) {
32+
33+ /**
34+ * If the iterable is not intance of \Traversable, it is an array => convert it to an ArrayIterator.
35+ *
36+ * @param $iterable
37+ * @return \Traversable
38+ */
3039 function iterable_to_traversable ($ iterable )
3140 {
3241 if ($ iterable instanceof Traversable) {
You can’t perform that action at this time.
0 commit comments