@@ -120,6 +120,10 @@ discard block |
||
| 120 | 120 | return true; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | + /** |
|
| 124 | + * @param \SplObjectStorage[] $iterable |
|
| 125 | + * @param string $method |
|
| 126 | + */ |
|
| 123 | 127 | public static function invoke($iterable, $method) |
| 124 | 128 | { |
| 125 | 129 | return new MapIterator($iterable, function($element) use ($method) { |
@@ -127,6 +131,9 @@ discard block |
||
| 127 | 131 | }); |
| 128 | 132 | } |
| 129 | 133 | |
| 134 | + /** |
|
| 135 | + * @param integer[] $iterable |
|
| 136 | + */ |
|
| 130 | 137 | public static function sum($iterable, $initialValue = 0) |
| 131 | 138 | { |
| 132 | 139 | self::assertIsCollection($iterable); |
@@ -137,6 +144,10 @@ discard block |
||
| 137 | 144 | return $sum; |
| 138 | 145 | } |
| 139 | 146 | |
| 147 | + /** |
|
| 148 | + * @param \Closure $callable |
|
| 149 | + * @param integer $initial |
|
| 150 | + */ |
|
| 140 | 151 | public static function iterator_reduce($iterable, $callable, $initial = null) |
| 141 | 152 | { |
| 142 | 153 | $returnValue = $initial; |