@@ -40,6 +40,9 @@ |
||
| 40 | 40 | return $iterator->current(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @return string |
|
| 45 | + */ |
|
| 43 | 46 | public static function reduce(\Traversable $iterator, callable $callback, $initial = null) |
| 44 | 47 | { |
| 45 | 48 | $callback = \Closure::fromCallable($callback); |
@@ -12,6 +12,9 @@ |
||
| 12 | 12 | parent::__construct($this->getShuffledIterator($iterator)); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param \Traversable $iterator |
|
| 17 | + */ |
|
| 15 | 18 | public function getShuffledIterator($iterator) |
| 16 | 19 | { |
| 17 | 20 | $sortedIterator = new \ArrayIterator(); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | // The outer iterator is a finite replaceable iterator with a condition |
| 44 | 44 | // on the inner iterator not being empty. |
| 45 | - parent::__construct(new InfiniteIterator(new ReplaceableIterator(), function ($iterator) { |
|
| 45 | + parent::__construct(new InfiniteIterator(new ReplaceableIterator(), function($iterator) { |
|
| 46 | 46 | return !$iterator->current()->valid(); |
| 47 | 47 | })); |
| 48 | 48 | } |