|
@@ 170-180 (lines=11) @@
|
| 167 |
|
* |
| 168 |
|
* @return ChainIterator |
| 169 |
|
*/ |
| 170 |
|
function chain() |
| 171 |
|
{ |
| 172 |
|
// note, once we stop supporting php 5.5, we can rewrite the code below |
| 173 |
|
// to the chain(...$iterables) structure. |
| 174 |
|
// http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
| 175 |
|
|
| 176 |
|
$iterables = array_map( |
| 177 |
|
function ($iterable) { |
| 178 |
|
return conversions\mixed_to_iterator($iterable); |
| 179 |
|
}, |
| 180 |
|
func_get_args() |
| 181 |
|
); |
| 182 |
|
$reflectorClass = new \ReflectionClass('\Zicht\Itertools\lib\ChainIterator'); |
| 183 |
|
return $reflectorClass->newInstanceArgs($iterables); |
|
@@ 603-613 (lines=11) @@
|
| 600 |
|
* @param array|string|\Iterator $iterable Additional $iterable parameters may follow |
| 601 |
|
* @return ZipIterator |
| 602 |
|
*/ |
| 603 |
|
function zip($iterableA) |
| 604 |
|
{ |
| 605 |
|
// note, once we stop supporting php 5.5, we can rewrite the code below |
| 606 |
|
// to the zip(...$iterables) structure. |
| 607 |
|
// http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
| 608 |
|
|
| 609 |
|
$iterables = array_map( |
| 610 |
|
function ($iterable) { |
| 611 |
|
return conversions\mixed_to_iterator($iterable); |
| 612 |
|
}, |
| 613 |
|
func_get_args() |
| 614 |
|
); |
| 615 |
|
$reflectorClass = new \ReflectionClass('\Zicht\Itertools\lib\ZipIterator'); |
| 616 |
|
return $reflectorClass->newInstanceArgs($iterables); |