@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | return new static; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $instance = new static(function () use ($number) { |
|
| 64 | + $instance = new static(function() use ($number) { |
|
| 65 | 65 | for ($current = 1; $current <= $number; $current++) { |
| 66 | 66 | yield $current; |
| 67 | 67 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public static function range($from, $to) |
| 81 | 81 | { |
| 82 | - return new static(function () use ($from, $to) { |
|
| 82 | + return new static(function() use ($from, $to) { |
|
| 83 | 83 | for (; $from <= $to; $from++) { |
| 84 | 84 | yield $from; |
| 85 | 85 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $cache = []; |
| 125 | 125 | |
| 126 | - return new static(function () use ($iterator, &$iteratorIndex, &$cache) { |
|
| 126 | + return new static(function() use ($iterator, &$iteratorIndex, &$cache) { |
|
| 127 | 127 | for ($index = 0; true; $index++) { |
| 128 | 128 | if (array_key_exists($index, $cache)) { |
| 129 | 129 | yield $cache[$index][0] => $cache[$index][1]; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function collapse() |
| 190 | 190 | { |
| 191 | - return new static(function () { |
|
| 191 | + return new static(function() { |
|
| 192 | 192 | foreach ($this as $values) { |
| 193 | 193 | if (is_array($values) || $values instanceof Enumerable) { |
| 194 | 194 | foreach ($values as $value) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | ? $this->identity() |
| 254 | 254 | : $this->valueRetriever($countBy); |
| 255 | 255 | |
| 256 | - return new static(function () use ($countBy) { |
|
| 256 | + return new static(function() use ($countBy) { |
|
| 257 | 257 | $counts = []; |
| 258 | 258 | |
| 259 | 259 | foreach ($this as $key => $value) { |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | public function filter(callable $callback = null) |
| 383 | 383 | { |
| 384 | 384 | if (is_null($callback)) { |
| 385 | - $callback = function ($value) { |
|
| 386 | - return (bool)$value; |
|
| 385 | + $callback = function($value) { |
|
| 386 | + return (bool) $value; |
|
| 387 | 387 | }; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - return new static(function () use ($callback) { |
|
| 390 | + return new static(function() use ($callback) { |
|
| 391 | 391 | foreach ($this as $key => $value) { |
| 392 | 392 | if ($callback($value, $key)) { |
| 393 | 393 | yield $key => $value; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | public function flatten($depth = INF) |
| 434 | 434 | { |
| 435 | - $instance = new static(function () use ($depth) { |
|
| 435 | + $instance = new static(function() use ($depth) { |
|
| 436 | 436 | foreach ($this as $item) { |
| 437 | 437 | if (!is_array($item) && !$item instanceof Enumerable) { |
| 438 | 438 | yield $item; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function flip() |
| 456 | 456 | { |
| 457 | - return new static(function () { |
|
| 457 | + return new static(function() { |
|
| 458 | 458 | foreach ($this as $key => $value) { |
| 459 | 459 | yield $value => $key; |
| 460 | 460 | } |
@@ -503,14 +503,14 @@ discard block |
||
| 503 | 503 | */ |
| 504 | 504 | public function keyBy($keyBy) |
| 505 | 505 | { |
| 506 | - return new static(function () use ($keyBy) { |
|
| 506 | + return new static(function() use ($keyBy) { |
|
| 507 | 507 | $keyBy = $this->valueRetriever($keyBy); |
| 508 | 508 | |
| 509 | 509 | foreach ($this as $key => $item) { |
| 510 | 510 | $resolvedKey = $keyBy($item, $key); |
| 511 | 511 | |
| 512 | 512 | if (is_object($resolvedKey)) { |
| 513 | - $resolvedKey = (string)$resolvedKey; |
|
| 513 | + $resolvedKey = (string) $resolvedKey; |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | yield $resolvedKey => $item; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | public function keys() |
| 603 | 603 | { |
| 604 | - return new static(function () { |
|
| 604 | + return new static(function() { |
|
| 605 | 605 | foreach ($this as $key => $value) { |
| 606 | 606 | yield $key; |
| 607 | 607 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | */ |
| 638 | 638 | public function pluck($value, $key = null) |
| 639 | 639 | { |
| 640 | - return new static(function () use ($value, $key) { |
|
| 640 | + return new static(function() use ($value, $key) { |
|
| 641 | 641 | [$value, $key] = $this->explodePluckParameters($value, $key); |
| 642 | 642 | |
| 643 | 643 | foreach ($this as $item) { |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | $itemKey = data_get($item, $key); |
| 650 | 650 | |
| 651 | 651 | if (is_object($itemKey) && method_exists($itemKey, '__toString')) { |
| 652 | - $itemKey = (string)$itemKey; |
|
| 652 | + $itemKey = (string) $itemKey; |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | yield $itemKey => $itemValue; |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | */ |
| 667 | 667 | public function map(callable $callback) |
| 668 | 668 | { |
| 669 | - return new static(function () use ($callback) { |
|
| 669 | + return new static(function() use ($callback) { |
|
| 670 | 670 | foreach ($this as $key => $value) { |
| 671 | 671 | yield $key => $callback($value, $key); |
| 672 | 672 | } |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | */ |
| 697 | 697 | public function mapWithKeys(callable $callback) |
| 698 | 698 | { |
| 699 | - return new static(function () use ($callback) { |
|
| 699 | + return new static(function() use ($callback) { |
|
| 700 | 700 | foreach ($this as $key => $value) { |
| 701 | 701 | yield from $callback($value, $key); |
| 702 | 702 | } |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | */ |
| 734 | 734 | public function combine($values) |
| 735 | 735 | { |
| 736 | - return new static(function () use ($values) { |
|
| 736 | + return new static(function() use ($values) { |
|
| 737 | 737 | $values = $this->makeIterator($values); |
| 738 | 738 | |
| 739 | 739 | $errorMessage = 'Both parameters should have an equal number of elements'; |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | */ |
| 777 | 777 | public function nth($step, $offset = 0) |
| 778 | 778 | { |
| 779 | - return new static(function () use ($step, $offset) { |
|
| 779 | + return new static(function() use ($step, $offset) { |
|
| 780 | 780 | $position = 0; |
| 781 | 781 | |
| 782 | 782 | foreach ($this as $item) { |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $keys = is_array($keys) ? $keys : func_get_args(); |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | - return new static(function () use ($keys) { |
|
| 806 | + return new static(function() use ($keys) { |
|
| 807 | 807 | if (is_null($keys)) { |
| 808 | 808 | yield from $this; |
| 809 | 809 | } else { |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | */ |
| 833 | 833 | public function concat($source) |
| 834 | 834 | { |
| 835 | - return (new static(function () use ($source) { |
|
| 835 | + return (new static(function() use ($source) { |
|
| 836 | 836 | yield from $this; |
| 837 | 837 | yield from $source; |
| 838 | 838 | }))->values(); |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | */ |
| 880 | 880 | public function replace($items) |
| 881 | 881 | { |
| 882 | - return new static(function () use ($items) { |
|
| 882 | + return new static(function() use ($items) { |
|
| 883 | 883 | $items = $this->getArrayableItems($items); |
| 884 | 884 | |
| 885 | 885 | foreach ($this as $key => $value) { |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | { |
| 931 | 931 | $predicate = $this->useAsCallable($value) |
| 932 | 932 | ? $value |
| 933 | - : function ($item) use ($value, $strict) { |
|
| 933 | + : function($item) use ($value, $strict) { |
|
| 934 | 934 | return $strict ? $item === $value : $item == $value; |
| 935 | 935 | }; |
| 936 | 936 | |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | */ |
| 963 | 963 | public function skip($count) |
| 964 | 964 | { |
| 965 | - return new static(function () use ($count) { |
|
| 965 | + return new static(function() use ($count) { |
|
| 966 | 966 | $iterator = $this->getIterator(); |
| 967 | 967 | |
| 968 | 968 | while ($iterator->valid() && $count--) { |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | { |
| 1001 | 1001 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
| 1002 | 1002 | |
| 1003 | - return new static(function () use ($callback) { |
|
| 1003 | + return new static(function() use ($callback) { |
|
| 1004 | 1004 | $iterator = $this->getIterator(); |
| 1005 | 1005 | |
| 1006 | 1006 | while ($iterator->valid() && $callback($iterator->current(), $iterator->key())) { |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | return static::empty(); |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | - return new static(function () use ($size) { |
|
| 1059 | + return new static(function() use ($size) { |
|
| 1060 | 1060 | $iterator = $this->getIterator(); |
| 1061 | 1061 | |
| 1062 | 1062 | while ($iterator->valid()) { |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | return $this->passthru('take', func_get_args()); |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | - return new static(function () use ($limit) { |
|
| 1168 | + return new static(function() use ($limit) { |
|
| 1169 | 1169 | $iterator = $this->getIterator(); |
| 1170 | 1170 | |
| 1171 | 1171 | while ($limit--) { |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | { |
| 1193 | 1193 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
| 1194 | 1194 | |
| 1195 | - return new static(function () use ($callback) { |
|
| 1195 | + return new static(function() use ($callback) { |
|
| 1196 | 1196 | foreach ($this as $key => $item) { |
| 1197 | 1197 | if ($callback($item, $key)) { |
| 1198 | 1198 | break; |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | { |
| 1214 | 1214 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
| 1215 | 1215 | |
| 1216 | - return $this->takeUntil(function ($item, $key) use ($callback) { |
|
| 1216 | + return $this->takeUntil(function($item, $key) use ($callback) { |
|
| 1217 | 1217 | return !$callback($item, $key); |
| 1218 | 1218 | }); |
| 1219 | 1219 | } |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | */ |
| 1227 | 1227 | public function tapEach(callable $callback) |
| 1228 | 1228 | { |
| 1229 | - return new static(function () use ($callback) { |
|
| 1229 | + return new static(function() use ($callback) { |
|
| 1230 | 1230 | foreach ($this as $key => $value) { |
| 1231 | 1231 | $callback($value, $key); |
| 1232 | 1232 | |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | */ |
| 1243 | 1243 | public function values() |
| 1244 | 1244 | { |
| 1245 | - return new static(function () { |
|
| 1245 | + return new static(function() { |
|
| 1246 | 1246 | foreach ($this as $item) { |
| 1247 | 1247 | yield $item; |
| 1248 | 1248 | } |
@@ -1262,8 +1262,8 @@ discard block |
||
| 1262 | 1262 | { |
| 1263 | 1263 | $iterables = func_get_args(); |
| 1264 | 1264 | |
| 1265 | - return new static(function () use ($iterables) { |
|
| 1266 | - $iterators = Collection::make($iterables)->map(function ($iterable) { |
|
| 1265 | + return new static(function() use ($iterables) { |
|
| 1266 | + $iterators = Collection::make($iterables)->map(function($iterable) { |
|
| 1267 | 1267 | return $this->makeIterator($iterable); |
| 1268 | 1268 | })->prepend($this->getIterator()); |
| 1269 | 1269 | |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | return $this->passthru('pad', func_get_args()); |
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | - return new static(function () use ($size, $value) { |
|
| 1291 | + return new static(function() use ($size, $value) { |
|
| 1292 | 1292 | $yielded = 0; |
| 1293 | 1293 | |
| 1294 | 1294 | foreach ($this as $index => $item) { |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | */ |
| 1372 | 1372 | protected function passthru($method, array $params) |
| 1373 | 1373 | { |
| 1374 | - return new static(function () use ($method, $params) { |
|
| 1374 | + return new static(function() use ($method, $params) { |
|
| 1375 | 1375 | yield from $this->collect()->$method(...$params); |
| 1376 | 1376 | }); |
| 1377 | 1377 | } |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $callback = $this->valueRetriever($callback); |
| 89 | 89 | |
| 90 | - $items = $this->map(function ($value) use ($callback) { |
|
| 90 | + $items = $this->map(function($value) use ($callback) { |
|
| 91 | 91 | return $callback($value); |
| 92 | - })->filter(function ($value) { |
|
| 92 | + })->filter(function($value) { |
|
| 93 | 93 | return !is_null($value); |
| 94 | 94 | }); |
| 95 | 95 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function median($key = null) |
| 108 | 108 | { |
| 109 | 109 | $values = (isset($key) ? $this->pluck($key) : $this) |
| 110 | - ->filter(function ($item) { |
|
| 110 | + ->filter(function($item) { |
|
| 111 | 111 | return !is_null($item); |
| 112 | 112 | })->sort()->values(); |
| 113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return null; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $middle = (int)($count / 2); |
|
| 120 | + $middle = (int) ($count / 2); |
|
| 121 | 121 | |
| 122 | 122 | if ($count % 2) { |
| 123 | 123 | return $values->get($middle); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $counts = new static; |
| 146 | 146 | |
| 147 | - $collection->each(function ($value) use ($counts) { |
|
| 147 | + $collection->each(function($value) use ($counts) { |
|
| 148 | 148 | $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; |
| 149 | 149 | }); |
| 150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $highestValue = $sorted->last(); |
| 154 | 154 | |
| 155 | - return $sorted->filter(function ($value) use ($highestValue) { |
|
| 155 | + return $sorted->filter(function($value) use ($highestValue) { |
|
| 156 | 156 | return $value == $highestValue; |
| 157 | 157 | })->sort()->keys()->all(); |
| 158 | 158 | } |
@@ -320,12 +320,12 @@ discard block |
||
| 320 | 320 | protected function duplicateComparator($strict) |
| 321 | 321 | { |
| 322 | 322 | if ($strict) { |
| 323 | - return function ($a, $b) { |
|
| 323 | + return function($a, $b) { |
|
| 324 | 324 | return $a === $b; |
| 325 | 325 | }; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return function ($a, $b) { |
|
| 328 | + return function($a, $b) { |
|
| 329 | 329 | return $a == $b; |
| 330 | 330 | }; |
| 331 | 331 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function forget($keys) |
| 405 | 405 | { |
| 406 | - foreach ((array)$keys as $key) { |
|
| 406 | + foreach ((array) $keys as $key) { |
|
| 407 | 407 | $this->offsetUnset($key); |
| 408 | 408 | } |
| 409 | 409 | |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | foreach ($groupKeys as $groupKey) { |
| 456 | - $groupKey = is_bool($groupKey) ? (int)$groupKey : $groupKey; |
|
| 456 | + $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey; |
|
| 457 | 457 | |
| 458 | 458 | if (!array_key_exists($groupKey, $results)) { |
| 459 | 459 | $results[$groupKey] = new static; |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $resolvedKey = $keyBy($item, $key); |
| 489 | 489 | |
| 490 | 490 | if (is_object($resolvedKey)) { |
| 491 | - $resolvedKey = (string)$resolvedKey; |
|
| 491 | + $resolvedKey = (string) $resolvedKey; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $results[$resolvedKey] = $item; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | $finalItem = $collection->pop(); |
| 597 | 597 | |
| 598 | - return $collection->implode($glue) . $finalGlue . $finalItem; |
|
| 598 | + return $collection->implode($glue).$finalGlue.$finalItem; |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** |
@@ -1278,11 +1278,11 @@ discard block |
||
| 1278 | 1278 | */ |
| 1279 | 1279 | public function zip($items) |
| 1280 | 1280 | { |
| 1281 | - $arrayableItems = array_map(function ($items) { |
|
| 1281 | + $arrayableItems = array_map(function($items) { |
|
| 1282 | 1282 | return $this->getArrayableItems($items); |
| 1283 | 1283 | }, func_get_args()); |
| 1284 | 1284 | |
| 1285 | - $params = array_merge([function () { |
|
| 1285 | + $params = array_merge([function() { |
|
| 1286 | 1286 | return new static(func_get_args()); |
| 1287 | 1287 | }, $this->items], $arrayableItems); |
| 1288 | 1288 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | foreach ($array as $key => $value) { |
| 115 | 115 | if (is_array($value) && !empty($value)) { |
| 116 | - $results = array_merge($results, static::dot($value, $prepend . $key . '.')); |
|
| 116 | + $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
|
| 117 | 117 | } else { |
| 118 | - $results[$prepend . $key] = $value; |
|
| 118 | + $results[$prepend.$key] = $value; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | $original = &$array; |
| 245 | 245 | |
| 246 | - $keys = (array)$keys; |
|
| 246 | + $keys = (array) $keys; |
|
| 247 | 247 | |
| 248 | 248 | if (count($keys) === 0) { |
| 249 | 249 | return; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | public static function has($array, $keys) |
| 324 | 324 | { |
| 325 | - $keys = (array)$keys; |
|
| 325 | + $keys = (array) $keys; |
|
| 326 | 326 | |
| 327 | 327 | if (!$array || $keys === []) { |
| 328 | 328 | return false; |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $keys = (array)$keys; |
|
| 363 | + $keys = (array) $keys; |
|
| 364 | 364 | |
| 365 | 365 | if (!$array) { |
| 366 | 366 | return false; |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public static function only($array, $keys) |
| 405 | 405 | { |
| 406 | - return array_intersect_key($array, array_flip((array)$keys)); |
|
| 406 | + return array_intersect_key($array, array_flip((array) $keys)); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $itemKey = data_get($item, $key); |
| 433 | 433 | |
| 434 | 434 | if (is_object($itemKey) && method_exists($itemKey, '__toString')) { |
| 435 | - $itemKey = (string)$itemKey; |
|
| 435 | + $itemKey = (string) $itemKey; |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | $results[$itemKey] = $itemValue; |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | return $array[array_rand($array)]; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if ((int)$number === 0) { |
|
| 523 | + if ((int) $number === 0) { |
|
| 524 | 524 | return []; |
| 525 | 525 | } |
| 526 | 526 | |
@@ -529,11 +529,11 @@ discard block |
||
| 529 | 529 | $results = []; |
| 530 | 530 | |
| 531 | 531 | if ($preserveKeys) { |
| 532 | - foreach ((array)$keys as $key) { |
|
| 532 | + foreach ((array) $keys as $key) { |
|
| 533 | 533 | $results[$key] = $array[$key]; |
| 534 | 534 | } |
| 535 | 535 | } else { |
| 536 | - foreach ((array)$keys as $key) { |
|
| 536 | + foreach ((array) $keys as $key) { |
|
| 537 | 537 | $results[] = $array[$key]; |
| 538 | 538 | } |
| 539 | 539 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function __get($key) |
| 46 | 46 | { |
| 47 | - return $this->collection->{$this->method}(function ($value) use ($key) { |
|
| 47 | + return $this->collection->{$this->method}(function($value) use ($key) { |
|
| 48 | 48 | return is_array($value) ? $value[$key] : $value->{$key}; |
| 49 | 49 | }); |
| 50 | 50 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function __call($method, $parameters) |
| 60 | 60 | { |
| 61 | - return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { |
|
| 61 | + return $this->collection->{$this->method}(function($value) use ($method, $parameters) { |
|
| 62 | 62 | return $value->{$method}(...$parameters); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | public function containsStrict($key, $value = null) |
| 144 | 144 | { |
| 145 | 145 | if (func_num_args() === 2) { |
| 146 | - return $this->contains(function ($item) use ($key, $value) { |
|
| 146 | + return $this->contains(function($item) use ($key, $value) { |
|
| 147 | 147 | return data_get($item, $key) === $value; |
| 148 | 148 | }); |
| 149 | 149 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | (new static(func_get_args())) |
| 183 | 183 | ->push($this) |
| 184 | - ->each(function ($item) { |
|
| 184 | + ->each(function($item) { |
|
| 185 | 185 | VarDumper::dump($item); |
| 186 | 186 | }); |
| 187 | 187 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function eachSpread(callable $callback) |
| 215 | 215 | { |
| 216 | - return $this->each(function ($chunk, $key) use ($callback) { |
|
| 216 | + return $this->each(function($chunk, $key) use ($callback) { |
|
| 217 | 217 | $chunk[] = $key; |
| 218 | 218 | |
| 219 | 219 | return $callback(...$chunk); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function mapSpread(callable $callback) |
| 278 | 278 | { |
| 279 | - return $this->map(function ($chunk, $key) use ($callback) { |
|
| 279 | + return $this->map(function($chunk, $key) use ($callback) { |
|
| 280 | 280 | $chunk[] = $key; |
| 281 | 281 | |
| 282 | 282 | return $callback(...$chunk); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function mapInto($class) |
| 319 | 319 | { |
| 320 | - return $this->map(function ($value, $key) use ($class) { |
|
| 320 | + return $this->map(function($value, $key) use ($class) { |
|
| 321 | 321 | return new $class($value, $key); |
| 322 | 322 | }); |
| 323 | 323 | } |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | $callback = $this->valueRetriever($callback); |
| 334 | 334 | |
| 335 | - return $this->map(function ($value) use ($callback) { |
|
| 335 | + return $this->map(function($value) use ($callback) { |
|
| 336 | 336 | return $callback($value); |
| 337 | - })->filter(function ($value) { |
|
| 337 | + })->filter(function($value) { |
|
| 338 | 338 | return !is_null($value); |
| 339 | - })->reduce(function ($result, $value) { |
|
| 339 | + })->reduce(function($result, $value) { |
|
| 340 | 340 | return is_null($result) || $value < $result ? $value : $result; |
| 341 | 341 | }); |
| 342 | 342 | } |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | $callback = $this->valueRetriever($callback); |
| 353 | 353 | |
| 354 | - return $this->filter(function ($value) { |
|
| 354 | + return $this->filter(function($value) { |
|
| 355 | 355 | return !is_null($value); |
| 356 | - })->reduce(function ($result, $item) use ($callback) { |
|
| 356 | + })->reduce(function($result, $item) use ($callback) { |
|
| 357 | 357 | $value = $callback($item); |
| 358 | 358 | |
| 359 | 359 | return is_null($result) || $value > $result ? $value : $result; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | ? $this->identity() |
| 415 | 415 | : $this->valueRetriever($callback); |
| 416 | 416 | |
| 417 | - return $this->reduce(function ($result, $item) use ($callback) { |
|
| 417 | + return $this->reduce(function($result, $item) use ($callback) { |
|
| 418 | 418 | return $result + $callback($item); |
| 419 | 419 | }, 0); |
| 420 | 420 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | { |
| 563 | 563 | $values = $this->getArrayableItems($values); |
| 564 | 564 | |
| 565 | - return $this->filter(function ($item) use ($key, $values, $strict) { |
|
| 565 | + return $this->filter(function($item) use ($key, $values, $strict) { |
|
| 566 | 566 | return in_array(data_get($item, $key), $values, $strict); |
| 567 | 567 | }); |
| 568 | 568 | } |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | */ |
| 601 | 601 | public function whereNotBetween($key, $values) |
| 602 | 602 | { |
| 603 | - return $this->filter(function ($item) use ($key, $values) { |
|
| 603 | + return $this->filter(function($item) use ($key, $values) { |
|
| 604 | 604 | return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values); |
| 605 | 605 | }); |
| 606 | 606 | } |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | { |
| 618 | 618 | $values = $this->getArrayableItems($values); |
| 619 | 619 | |
| 620 | - return $this->reject(function ($item) use ($key, $values, $strict) { |
|
| 620 | + return $this->reject(function($item) use ($key, $values, $strict) { |
|
| 621 | 621 | return in_array(data_get($item, $key), $values, $strict); |
| 622 | 622 | }); |
| 623 | 623 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | public function whereInstanceOf($type) |
| 644 | 644 | { |
| 645 | - return $this->filter(function ($value) use ($type) { |
|
| 645 | + return $this->filter(function($value) use ($type) { |
|
| 646 | 646 | return $value instanceof $type; |
| 647 | 647 | }); |
| 648 | 648 | } |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | { |
| 682 | 682 | $useAsCallable = $this->useAsCallable($callback); |
| 683 | 683 | |
| 684 | - return $this->filter(function ($value, $key) use ($callback, $useAsCallable) { |
|
| 684 | + return $this->filter(function($value, $key) use ($callback, $useAsCallable) { |
|
| 685 | 685 | return $useAsCallable |
| 686 | 686 | ? !$callback($value, $key) |
| 687 | 687 | : $value != $callback; |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | $exists = []; |
| 703 | 703 | |
| 704 | - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { |
|
| 704 | + return $this->reject(function($item, $key) use ($callback, $strict, &$exists) { |
|
| 705 | 705 | if (in_array($id = $callback($item, $key), $exists, $strict)) { |
| 706 | 706 | return true; |
| 707 | 707 | } |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | */ |
| 754 | 754 | public function toArray() |
| 755 | 755 | { |
| 756 | - return $this->map(function ($value) { |
|
| 756 | + return $this->map(function($value) { |
|
| 757 | 757 | return $value instanceof Arrayable ? $value->toArray() : $value; |
| 758 | 758 | })->all(); |
| 759 | 759 | } |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | public function jsonSerialize() |
| 767 | 767 | { |
| 768 | - return array_map(function ($value) { |
|
| 768 | + return array_map(function($value) { |
|
| 769 | 769 | if ($value instanceof JsonSerializable) { |
| 770 | 770 | return $value->jsonSerialize(); |
| 771 | 771 | } elseif ($value instanceof Jsonable) { |
@@ -855,12 +855,12 @@ discard block |
||
| 855 | 855 | } elseif ($items instanceof Jsonable) { |
| 856 | 856 | return json_decode($items->toJson(), true); |
| 857 | 857 | } elseif ($items instanceof JsonSerializable) { |
| 858 | - return (array)$items->jsonSerialize(); |
|
| 858 | + return (array) $items->jsonSerialize(); |
|
| 859 | 859 | } elseif ($items instanceof Traversable) { |
| 860 | 860 | return iterator_to_array($items); |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | - return (array)$items; |
|
| 863 | + return (array) $items; |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | /** |
@@ -885,10 +885,10 @@ discard block |
||
| 885 | 885 | $operator = '='; |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | - return function ($item) use ($key, $operator, $value) { |
|
| 888 | + return function($item) use ($key, $operator, $value) { |
|
| 889 | 889 | $retrieved = data_get($item, $key); |
| 890 | 890 | |
| 891 | - $strings = array_filter([$retrieved, $value], function ($value) { |
|
| 891 | + $strings = array_filter([$retrieved, $value], function($value) { |
|
| 892 | 892 | return is_string($value) || (is_object($value) && method_exists($value, '__toString')); |
| 893 | 893 | }); |
| 894 | 894 | |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | return $value; |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - return function ($item) use ($value) { |
|
| 946 | + return function($item) use ($value) { |
|
| 947 | 947 | return data_get($item, $value); |
| 948 | 948 | }; |
| 949 | 949 | } |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | */ |
| 957 | 957 | protected function equality($value) |
| 958 | 958 | { |
| 959 | - return function ($item) use ($value) { |
|
| 959 | + return function($item) use ($value) { |
|
| 960 | 960 | return $item === $value; |
| 961 | 961 | }; |
| 962 | 962 | } |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | */ |
| 970 | 970 | protected function negate(Closure $callback) |
| 971 | 971 | { |
| 972 | - return function (...$params) use ($callback) { |
|
| 972 | + return function(...$params) use ($callback) { |
|
| 973 | 973 | return !$callback(...$params); |
| 974 | 974 | }; |
| 975 | 975 | } |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | */ |
| 982 | 982 | protected function identity() |
| 983 | 983 | { |
| 984 | - return function ($value) { |
|
| 984 | + return function($value) { |
|
| 985 | 985 | return $value; |
| 986 | 986 | }; |
| 987 | 987 | } |