@@ -75,7 +75,7 @@ |
||
75 | 75 | { |
76 | 76 | $window = $onEachSide + 4; |
77 | 77 | |
78 | - if (! $this->hasPages()) { |
|
78 | + if (!$this->hasPages()) { |
|
79 | 79 | return ['first' => null, 'slider' => null, 'last' => null]; |
80 | 80 | } |
81 | 81 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->items = $this->items->slice(0, $this->perPage); |
60 | 60 | |
61 | - if (! is_null($this->cursor) && $this->cursor->pointsToPreviousItems()) { |
|
61 | + if (!is_null($this->cursor) && $this->cursor->pointsToPreviousItems()) { |
|
62 | 62 | $this->items = $this->items->reverse()->values(); |
63 | 63 | } |
64 | 64 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | public function hasMorePages() |
98 | 98 | { |
99 | 99 | return (is_null($this->cursor) && $this->hasMore) || |
100 | - (! is_null($this->cursor) && $this->cursor->pointsToNextItems() && $this->hasMore) || |
|
101 | - (! is_null($this->cursor) && $this->cursor->pointsToPreviousItems()); |
|
100 | + (!is_null($this->cursor) && $this->cursor->pointsToNextItems() && $this->hasMore) || |
|
101 | + (!is_null($this->cursor) && $this->cursor->pointsToPreviousItems()); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function hasPages() |
110 | 110 | { |
111 | - return ! $this->onFirstPage() || $this->hasMorePages(); |
|
111 | + return !$this->onFirstPage() || $this->hasMorePages(); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function onFirstPage() |
120 | 120 | { |
121 | - return is_null($this->cursor) || ($this->cursor->pointsToPreviousItems() && ! $this->hasMore); |
|
121 | + return is_null($this->cursor) || ($this->cursor->pointsToPreviousItems() && !$this->hasMore); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getUrlRange($start, $end) |
156 | 156 | { |
157 | - return collect(range($start, $end))->mapWithKeys(function ($page) { |
|
157 | + return collect(range($start, $end))->mapWithKeys(function($page) { |
|
158 | 158 | return [$page => $this->url($page)]; |
159 | 159 | })->all(); |
160 | 160 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | */ |
387 | 387 | public function onLastPage() |
388 | 388 | { |
389 | - return ! $this->hasMorePages(); |
|
389 | + return !$this->hasMorePages(); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public static function resolveUsing($app) |
14 | 14 | { |
15 | - Paginator::viewFactoryResolver(function () use ($app) { |
|
15 | + Paginator::viewFactoryResolver(function() use ($app) { |
|
16 | 16 | return $app['view']; |
17 | 17 | }); |
18 | 18 | |
19 | - Paginator::currentPathResolver(function () use ($app) { |
|
19 | + Paginator::currentPathResolver(function() use ($app) { |
|
20 | 20 | return $app['request']->url(); |
21 | 21 | }); |
22 | 22 | |
23 | - Paginator::currentPageResolver(function ($pageName = 'page') use ($app) { |
|
23 | + Paginator::currentPageResolver(function($pageName = 'page') use ($app) { |
|
24 | 24 | $page = $app['request']->input($pageName); |
25 | 25 | |
26 | 26 | if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | return 1; |
31 | 31 | }); |
32 | 32 | |
33 | - Paginator::queryStringResolver(function () use ($app) { |
|
33 | + Paginator::queryStringResolver(function() use ($app) { |
|
34 | 34 | return $app['request']->query(); |
35 | 35 | }); |
36 | 36 | |
37 | - CursorPaginator::currentCursorResolver(function ($cursorName = 'cursor') use ($app) { |
|
37 | + CursorPaginator::currentCursorResolver(function($cursorName = 'cursor') use ($app) { |
|
38 | 38 | return Cursor::fromEncoded($app['request']->input($cursorName)); |
39 | 39 | }); |
40 | 40 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach ($array as $values) { |
52 | 52 | if ($values instanceof Collection) { |
53 | 53 | $values = $values->all(); |
54 | - } elseif (! is_array($values)) { |
|
54 | + } elseif (!is_array($values)) { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $results = []; |
112 | 112 | |
113 | 113 | foreach ($array as $key => $value) { |
114 | - if (is_array($value) && ! empty($value)) { |
|
114 | + if (is_array($value) && !empty($value)) { |
|
115 | 115 | $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
116 | 116 | } else { |
117 | 117 | $results[$prepend.$key] = $value; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | foreach ($array as $item) { |
233 | 233 | $item = $item instanceof Collection ? $item->all() : $item; |
234 | 234 | |
235 | - if (! is_array($item)) { |
|
235 | + if (!is_array($item)) { |
|
236 | 236 | $result[] = $item; |
237 | 237 | } else { |
238 | 238 | $values = $depth === 1 |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function get($array, $key, $default = null) |
304 | 304 | { |
305 | - if (! static::accessible($array)) { |
|
305 | + if (!static::accessible($array)) { |
|
306 | 306 | return value($default); |
307 | 307 | } |
308 | 308 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | { |
341 | 341 | $keys = (array) $keys; |
342 | 342 | |
343 | - if (! $array || $keys === []) { |
|
343 | + if (!$array || $keys === []) { |
|
344 | 344 | return false; |
345 | 345 | } |
346 | 346 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | $keys = (array) $keys; |
380 | 380 | |
381 | - if (! $array) { |
|
381 | + if (!$array) { |
|
382 | 382 | return false; |
383 | 383 | } |
384 | 384 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public static function isList($array) |
422 | 422 | { |
423 | - return ! self::isAssoc($array); |
|
423 | + return !self::isAssoc($array); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | // If the key doesn't exist at this depth, we will just create an empty array |
610 | 610 | // to hold the next value, allowing us to create the arrays to hold final |
611 | 611 | // values at the correct depth. Then we'll keep digging into the array. |
612 | - if (! isset($array[$key]) || ! is_array($array[$key])) { |
|
612 | + if (!isset($array[$key]) || !is_array($array[$key])) { |
|
613 | 613 | $array[$key] = []; |
614 | 614 | } |
615 | 615 | |
@@ -725,8 +725,8 @@ discard block |
||
725 | 725 | */ |
726 | 726 | public static function whereNotNull($array) |
727 | 727 | { |
728 | - return static::where($array, function ($value) { |
|
729 | - return ! is_null($value); |
|
728 | + return static::where($array, function($value) { |
|
729 | + return !is_null($value); |
|
730 | 730 | }); |
731 | 731 | } |
732 | 732 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Illuminate\Support\Arr; |
4 | 4 | use Illuminate\Support\Collection; |
5 | 5 | |
6 | -if (! function_exists('collect')) { |
|
6 | +if (!function_exists('collect')) { |
|
7 | 7 | /** |
8 | 8 | * Create a collection from the given value. |
9 | 9 | * |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | -if (! function_exists('data_fill')) { |
|
19 | +if (!function_exists('data_fill')) { |
|
20 | 20 | /** |
21 | 21 | * Fill in data where it's missing. |
22 | 22 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -if (! function_exists('data_get')) { |
|
34 | +if (!function_exists('data_get')) { |
|
35 | 35 | /** |
36 | 36 | * Get an item from an array or object using "dot" notation. |
37 | 37 | * |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($segment === '*') { |
59 | 59 | if ($target instanceof Collection) { |
60 | 60 | $target = $target->all(); |
61 | - } elseif (! is_array($target)) { |
|
61 | + } elseif (!is_array($target)) { |
|
62 | 62 | return value($default); |
63 | 63 | } |
64 | 64 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | -if (! function_exists('data_set')) { |
|
87 | +if (!function_exists('data_set')) { |
|
88 | 88 | /** |
89 | 89 | * Set an item on an array or object using dot notation. |
90 | 90 | * |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $segments = is_array($key) ? $key : explode('.', $key); |
100 | 100 | |
101 | 101 | if (($segment = array_shift($segments)) === '*') { |
102 | - if (! Arr::accessible($target)) { |
|
102 | + if (!Arr::accessible($target)) { |
|
103 | 103 | $target = []; |
104 | 104 | } |
105 | 105 | |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | } |
115 | 115 | } elseif (Arr::accessible($target)) { |
116 | 116 | if ($segments) { |
117 | - if (! Arr::exists($target, $segment)) { |
|
117 | + if (!Arr::exists($target, $segment)) { |
|
118 | 118 | $target[$segment] = []; |
119 | 119 | } |
120 | 120 | |
121 | 121 | data_set($target[$segment], $segments, $value, $overwrite); |
122 | - } elseif ($overwrite || ! Arr::exists($target, $segment)) { |
|
122 | + } elseif ($overwrite || !Arr::exists($target, $segment)) { |
|
123 | 123 | $target[$segment] = $value; |
124 | 124 | } |
125 | 125 | } elseif (is_object($target)) { |
126 | 126 | if ($segments) { |
127 | - if (! isset($target->{$segment})) { |
|
127 | + if (!isset($target->{$segment})) { |
|
128 | 128 | $target->{$segment} = []; |
129 | 129 | } |
130 | 130 | |
131 | 131 | data_set($target->{$segment}, $segments, $value, $overwrite); |
132 | - } elseif ($overwrite || ! isset($target->{$segment})) { |
|
132 | + } elseif ($overwrite || !isset($target->{$segment})) { |
|
133 | 133 | $target->{$segment} = $value; |
134 | 134 | } |
135 | 135 | } else { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | -if (! function_exists('head')) { |
|
149 | +if (!function_exists('head')) { |
|
150 | 150 | /** |
151 | 151 | * Get the first element of an array. Useful for method chaining. |
152 | 152 | * |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | -if (! function_exists('last')) { |
|
162 | +if (!function_exists('last')) { |
|
163 | 163 | /** |
164 | 164 | * Get the last element from an array. |
165 | 165 | * |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | -if (! function_exists('value')) { |
|
175 | +if (!function_exists('value')) { |
|
176 | 176 | /** |
177 | 177 | * Return the default value of the given value. |
178 | 178 | * |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | { |
74 | 74 | $callback = $this->valueRetriever($callback); |
75 | 75 | |
76 | - $items = $this->map(function ($value) use ($callback) { |
|
76 | + $items = $this->map(function($value) use ($callback) { |
|
77 | 77 | return $callback($value); |
78 | - })->filter(function ($value) { |
|
79 | - return ! is_null($value); |
|
78 | + })->filter(function($value) { |
|
79 | + return !is_null($value); |
|
80 | 80 | }); |
81 | 81 | |
82 | 82 | if ($count = $items->count()) { |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | public function median($key = null) |
94 | 94 | { |
95 | 95 | $values = (isset($key) ? $this->pluck($key) : $this) |
96 | - ->filter(function ($item) { |
|
97 | - return ! is_null($item); |
|
96 | + ->filter(function($item) { |
|
97 | + return !is_null($item); |
|
98 | 98 | })->sort()->values(); |
99 | 99 | |
100 | 100 | $count = $values->count(); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $counts = new static; |
132 | 132 | |
133 | - $collection->each(function ($value) use ($counts) { |
|
133 | + $collection->each(function($value) use ($counts) { |
|
134 | 134 | $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; |
135 | 135 | }); |
136 | 136 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $highestValue = $sorted->last(); |
140 | 140 | |
141 | - return $sorted->filter(function ($value) use ($highestValue) { |
|
141 | + return $sorted->filter(function($value) use ($highestValue) { |
|
142 | 142 | return $value == $highestValue; |
143 | 143 | })->sort()->keys()->all(); |
144 | 144 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function doesntContain($key, $operator = null, $value = null) |
188 | 188 | { |
189 | - return ! $this->contains(...func_get_args()); |
|
189 | + return !$this->contains(...func_get_args()); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -319,12 +319,12 @@ discard block |
||
319 | 319 | protected function duplicateComparator($strict) |
320 | 320 | { |
321 | 321 | if ($strict) { |
322 | - return function ($a, $b) { |
|
322 | + return function($a, $b) { |
|
323 | 323 | return $a === $b; |
324 | 324 | }; |
325 | 325 | } |
326 | 326 | |
327 | - return function ($a, $b) { |
|
327 | + return function($a, $b) { |
|
328 | 328 | return $a == $b; |
329 | 329 | }; |
330 | 330 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | { |
340 | 340 | if ($keys instanceof Enumerable) { |
341 | 341 | $keys = $keys->all(); |
342 | - } elseif (! is_array($keys)) { |
|
342 | + } elseif (!is_array($keys)) { |
|
343 | 343 | $keys = func_get_args(); |
344 | 344 | } |
345 | 345 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function groupBy($groupBy, $preserveKeys = false) |
454 | 454 | { |
455 | - if (! $this->useAsCallable($groupBy) && is_array($groupBy)) { |
|
455 | + if (!$this->useAsCallable($groupBy) && is_array($groupBy)) { |
|
456 | 456 | $nextGroups = $groupBy; |
457 | 457 | |
458 | 458 | $groupBy = array_shift($nextGroups); |
@@ -465,14 +465,14 @@ discard block |
||
465 | 465 | foreach ($this->items as $key => $value) { |
466 | 466 | $groupKeys = $groupBy($value, $key); |
467 | 467 | |
468 | - if (! is_array($groupKeys)) { |
|
468 | + if (!is_array($groupKeys)) { |
|
469 | 469 | $groupKeys = [$groupKeys]; |
470 | 470 | } |
471 | 471 | |
472 | 472 | foreach ($groupKeys as $groupKey) { |
473 | 473 | $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey; |
474 | 474 | |
475 | - if (! array_key_exists($groupKey, $results)) { |
|
475 | + if (!array_key_exists($groupKey, $results)) { |
|
476 | 476 | $results[$groupKey] = new static; |
477 | 477 | } |
478 | 478 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | |
483 | 483 | $result = new static($results); |
484 | 484 | |
485 | - if (! empty($nextGroups)) { |
|
485 | + if (!empty($nextGroups)) { |
|
486 | 486 | return $result->map->groupBy($nextGroups, $preserveKeys); |
487 | 487 | } |
488 | 488 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $keys = is_array($key) ? $key : func_get_args(); |
526 | 526 | |
527 | 527 | foreach ($keys as $value) { |
528 | - if (! array_key_exists($value, $this->items)) { |
|
528 | + if (!array_key_exists($value, $this->items)) { |
|
529 | 529 | return false; |
530 | 530 | } |
531 | 531 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | { |
568 | 568 | $first = $this->first(); |
569 | 569 | |
570 | - if (is_array($first) || (is_object($first) && ! $first instanceof Stringable)) { |
|
570 | + if (is_array($first) || (is_object($first) && !$first instanceof Stringable)) { |
|
571 | 571 | return implode($glue ?? '', $this->pluck($value)->all()); |
572 | 572 | } |
573 | 573 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | |
717 | 717 | $value = reset($pair); |
718 | 718 | |
719 | - if (! isset($dictionary[$key])) { |
|
719 | + if (!isset($dictionary[$key])) { |
|
720 | 720 | $dictionary[$key] = []; |
721 | 721 | } |
722 | 722 | |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | */ |
996 | 996 | public function search($value, $strict = false) |
997 | 997 | { |
998 | - if (! $this->useAsCallable($value)) { |
|
998 | + if (!$this->useAsCallable($value)) { |
|
999 | 999 | return array_search($value, $this->items, $strict); |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | { |
1058 | 1058 | $chunks = floor(($this->count() - $size) / $step) + 1; |
1059 | 1059 | |
1060 | - return static::times($chunks, function ($number) use ($size, $step) { |
|
1060 | + return static::times($chunks, function($number) use ($size, $step) { |
|
1061 | 1061 | return $this->slice(($number - 1) * $step, $size); |
1062 | 1062 | }); |
1063 | 1063 | } |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | public function sortBy($callback, $options = SORT_REGULAR, $descending = false) |
1290 | 1290 | { |
1291 | - if (is_array($callback) && ! is_callable($callback)) { |
|
1291 | + if (is_array($callback) && !is_callable($callback)) { |
|
1292 | 1292 | return $this->sortByMany($callback); |
1293 | 1293 | } |
1294 | 1294 | |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | { |
1327 | 1327 | $items = $this->items; |
1328 | 1328 | |
1329 | - usort($items, function ($a, $b) use ($comparisons) { |
|
1329 | + usort($items, function($a, $b) use ($comparisons) { |
|
1330 | 1330 | foreach ($comparisons as $comparison) { |
1331 | 1331 | $comparison = Arr::wrap($comparison); |
1332 | 1332 | |
@@ -1337,12 +1337,12 @@ discard block |
||
1337 | 1337 | |
1338 | 1338 | $result = 0; |
1339 | 1339 | |
1340 | - if (! is_string($prop) && is_callable($prop)) { |
|
1340 | + if (!is_string($prop) && is_callable($prop)) { |
|
1341 | 1341 | $result = $prop($a, $b); |
1342 | 1342 | } else { |
1343 | 1343 | $values = [data_get($a, $prop), data_get($b, $prop)]; |
1344 | 1344 | |
1345 | - if (! $ascending) { |
|
1345 | + if (!$ascending) { |
|
1346 | 1346 | $values = array_reverse($values); |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | |
1509 | 1509 | $exists = []; |
1510 | 1510 | |
1511 | - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { |
|
1511 | + return $this->reject(function($item, $key) use ($callback, $strict, &$exists) { |
|
1512 | 1512 | if (in_array($id = $callback($item, $key), $exists, $strict)) { |
1513 | 1513 | return true; |
1514 | 1514 | } |
@@ -1538,11 +1538,11 @@ discard block |
||
1538 | 1538 | */ |
1539 | 1539 | public function zip($items) |
1540 | 1540 | { |
1541 | - $arrayableItems = array_map(function ($items) { |
|
1541 | + $arrayableItems = array_map(function($items) { |
|
1542 | 1542 | return $this->getArrayableItems($items); |
1543 | 1543 | }, func_get_args()); |
1544 | 1544 | |
1545 | - $params = array_merge([function () { |
|
1545 | + $params = array_merge([function() { |
|
1546 | 1546 | return new static(func_get_args()); |
1547 | 1547 | }, $this->items], $arrayableItems); |
1548 | 1548 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function __get($key) |
44 | 44 | { |
45 | - return $this->collection->{$this->method}(function ($value) use ($key) { |
|
45 | + return $this->collection->{$this->method}(function($value) use ($key) { |
|
46 | 46 | return is_array($value) ? $value[$key] : $value->{$key}; |
47 | 47 | }); |
48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function __call($method, $parameters) |
58 | 58 | { |
59 | - return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { |
|
59 | + return $this->collection->{$this->method}(function($value) use ($method, $parameters) { |
|
60 | 60 | return $value->{$method}(...$parameters); |
61 | 61 | }); |
62 | 62 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public static function range($from, $to) |
50 | 50 | { |
51 | - return new static(function () use ($from, $to) { |
|
51 | + return new static(function() use ($from, $to) { |
|
52 | 52 | if ($from <= $to) { |
53 | 53 | for (; $from <= $to; $from++) { |
54 | 54 | yield $from; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $cache = []; |
100 | 100 | |
101 | - return new static(function () use ($iterator, &$iteratorIndex, &$cache) { |
|
101 | + return new static(function() use ($iterator, &$iteratorIndex, &$cache) { |
|
102 | 102 | for ($index = 0; true; $index++) { |
103 | 103 | if (array_key_exists($index, $cache)) { |
104 | 104 | yield $cache[$index][0] => $cache[$index][1]; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $iteratorIndex++; |
113 | 113 | } |
114 | 114 | |
115 | - if (! $iterator->valid()) { |
|
115 | + if (!$iterator->valid()) { |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function collapse() |
165 | 165 | { |
166 | - return new static(function () { |
|
166 | + return new static(function() { |
|
167 | 167 | foreach ($this as $values) { |
168 | 168 | if (is_array($values) || $values instanceof Enumerable) { |
169 | 169 | foreach ($values as $value) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function doesntContain($key, $operator = null, $value = null) |
217 | 217 | { |
218 | - return ! $this->contains(...func_get_args()); |
|
218 | + return !$this->contains(...func_get_args()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | ? $this->identity() |
242 | 242 | : $this->valueRetriever($countBy); |
243 | 243 | |
244 | - return new static(function () use ($countBy) { |
|
244 | + return new static(function() use ($countBy) { |
|
245 | 245 | $counts = []; |
246 | 246 | |
247 | 247 | foreach ($this as $key => $value) { |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | public function filter(callable $callback = null) |
371 | 371 | { |
372 | 372 | if (is_null($callback)) { |
373 | - $callback = function ($value) { |
|
373 | + $callback = function($value) { |
|
374 | 374 | return (bool) $value; |
375 | 375 | }; |
376 | 376 | } |
377 | 377 | |
378 | - return new static(function () use ($callback) { |
|
378 | + return new static(function() use ($callback) { |
|
379 | 379 | foreach ($this as $key => $value) { |
380 | 380 | if ($callback($value, $key)) { |
381 | 381 | yield $key => $value; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $iterator = $this->getIterator(); |
397 | 397 | |
398 | 398 | if (is_null($callback)) { |
399 | - if (! $iterator->valid()) { |
|
399 | + if (!$iterator->valid()) { |
|
400 | 400 | return value($default); |
401 | 401 | } |
402 | 402 | |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function flatten($depth = INF) |
422 | 422 | { |
423 | - $instance = new static(function () use ($depth) { |
|
423 | + $instance = new static(function() use ($depth) { |
|
424 | 424 | foreach ($this as $item) { |
425 | - if (! is_array($item) && ! $item instanceof Enumerable) { |
|
425 | + if (!is_array($item) && !$item instanceof Enumerable) { |
|
426 | 426 | yield $item; |
427 | 427 | } elseif ($depth === 1) { |
428 | 428 | yield from $item; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function flip() |
444 | 444 | { |
445 | - return new static(function () { |
|
445 | + return new static(function() { |
|
446 | 446 | foreach ($this as $key => $value) { |
447 | 447 | yield $value => $key; |
448 | 448 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | */ |
492 | 492 | public function keyBy($keyBy) |
493 | 493 | { |
494 | - return new static(function () use ($keyBy) { |
|
494 | + return new static(function() use ($keyBy) { |
|
495 | 495 | $keyBy = $this->valueRetriever($keyBy); |
496 | 496 | |
497 | 497 | foreach ($this as $key => $item) { |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public function isEmpty() |
588 | 588 | { |
589 | - return ! $this->getIterator()->valid(); |
|
589 | + return !$this->getIterator()->valid(); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | /** |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | */ |
619 | 619 | public function keys() |
620 | 620 | { |
621 | - return new static(function () { |
|
621 | + return new static(function() { |
|
622 | 622 | foreach ($this as $key => $value) { |
623 | 623 | yield $key; |
624 | 624 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | */ |
655 | 655 | public function pluck($value, $key = null) |
656 | 656 | { |
657 | - return new static(function () use ($value, $key) { |
|
657 | + return new static(function() use ($value, $key) { |
|
658 | 658 | [$value, $key] = $this->explodePluckParameters($value, $key); |
659 | 659 | |
660 | 660 | foreach ($this as $item) { |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | */ |
684 | 684 | public function map(callable $callback) |
685 | 685 | { |
686 | - return new static(function () use ($callback) { |
|
686 | + return new static(function() use ($callback) { |
|
687 | 687 | foreach ($this as $key => $value) { |
688 | 688 | yield $key => $callback($value, $key); |
689 | 689 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | */ |
714 | 714 | public function mapWithKeys(callable $callback) |
715 | 715 | { |
716 | - return new static(function () use ($callback) { |
|
716 | + return new static(function() use ($callback) { |
|
717 | 717 | foreach ($this as $key => $value) { |
718 | 718 | yield from $callback($value, $key); |
719 | 719 | } |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | */ |
751 | 751 | public function combine($values) |
752 | 752 | { |
753 | - return new static(function () use ($values) { |
|
753 | + return new static(function() use ($values) { |
|
754 | 754 | $values = $this->makeIterator($values); |
755 | 755 | |
756 | 756 | $errorMessage = 'Both parameters should have an equal number of elements'; |
757 | 757 | |
758 | 758 | foreach ($this as $key) { |
759 | - if (! $values->valid()) { |
|
759 | + if (!$values->valid()) { |
|
760 | 760 | trigger_error($errorMessage, E_USER_WARNING); |
761 | 761 | |
762 | 762 | break; |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | */ |
794 | 794 | public function nth($step, $offset = 0) |
795 | 795 | { |
796 | - return new static(function () use ($step, $offset) { |
|
796 | + return new static(function() use ($step, $offset) { |
|
797 | 797 | $position = 0; |
798 | 798 | |
799 | 799 | foreach ($this->slice($offset) as $item) { |
@@ -816,11 +816,11 @@ discard block |
||
816 | 816 | { |
817 | 817 | if ($keys instanceof Enumerable) { |
818 | 818 | $keys = $keys->all(); |
819 | - } elseif (! is_null($keys)) { |
|
819 | + } elseif (!is_null($keys)) { |
|
820 | 820 | $keys = is_array($keys) ? $keys : func_get_args(); |
821 | 821 | } |
822 | 822 | |
823 | - return new static(function () use ($keys) { |
|
823 | + return new static(function() use ($keys) { |
|
824 | 824 | if (is_null($keys)) { |
825 | 825 | yield from $this; |
826 | 826 | } else { |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | */ |
850 | 850 | public function concat($source) |
851 | 851 | { |
852 | - return (new static(function () use ($source) { |
|
852 | + return (new static(function() use ($source) { |
|
853 | 853 | yield from $this; |
854 | 854 | yield from $source; |
855 | 855 | }))->values(); |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | */ |
879 | 879 | public function replace($items) |
880 | 880 | { |
881 | - return new static(function () use ($items) { |
|
881 | + return new static(function() use ($items) { |
|
882 | 882 | $items = $this->getArrayableItems($items); |
883 | 883 | |
884 | 884 | foreach ($this as $key => $value) { |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | { |
930 | 930 | $predicate = $this->useAsCallable($value) |
931 | 931 | ? $value |
932 | - : function ($item) use ($value, $strict) { |
|
932 | + : function($item) use ($value, $strict) { |
|
933 | 933 | return $strict ? $item === $value : $item == $value; |
934 | 934 | }; |
935 | 935 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | */ |
963 | 963 | public function sliding($size = 2, $step = 1) |
964 | 964 | { |
965 | - return new static(function () use ($size, $step) { |
|
965 | + return new static(function() use ($size, $step) { |
|
966 | 966 | $iterator = $this->getIterator(); |
967 | 967 | |
968 | 968 | $chunk = []; |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | $chunk[$iterator->key()] = $iterator->current(); |
972 | 972 | |
973 | 973 | if (count($chunk) == $size) { |
974 | - yield tap(new static($chunk), function () use (&$chunk, $step) { |
|
974 | + yield tap(new static($chunk), function() use (&$chunk, $step) { |
|
975 | 975 | $chunk = array_slice($chunk, $step, null, true); |
976 | 976 | }); |
977 | 977 | |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | public function skip($count) |
1002 | 1002 | { |
1003 | - return new static(function () use ($count) { |
|
1003 | + return new static(function() use ($count) { |
|
1004 | 1004 | $iterator = $this->getIterator(); |
1005 | 1005 | |
1006 | 1006 | while ($iterator->valid() && $count--) { |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | { |
1039 | 1039 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
1040 | 1040 | |
1041 | - return new static(function () use ($callback) { |
|
1041 | + return new static(function() use ($callback) { |
|
1042 | 1042 | $iterator = $this->getIterator(); |
1043 | 1043 | |
1044 | 1044 | while ($iterator->valid() && $callback($iterator->current(), $iterator->key())) { |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | return static::empty(); |
1144 | 1144 | } |
1145 | 1145 | |
1146 | - return new static(function () use ($size) { |
|
1146 | + return new static(function() use ($size) { |
|
1147 | 1147 | $iterator = $this->getIterator(); |
1148 | 1148 | |
1149 | 1149 | while ($iterator->valid()) { |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | if (count($chunk) < $size) { |
1156 | 1156 | $iterator->next(); |
1157 | 1157 | |
1158 | - if (! $iterator->valid()) { |
|
1158 | + if (!$iterator->valid()) { |
|
1159 | 1159 | break; |
1160 | 1160 | } |
1161 | 1161 | } else { |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | */ |
1190 | 1190 | public function chunkWhile(callable $callback) |
1191 | 1191 | { |
1192 | - return new static(function () use ($callback) { |
|
1192 | + return new static(function() use ($callback) { |
|
1193 | 1193 | $iterator = $this->getIterator(); |
1194 | 1194 | |
1195 | 1195 | $chunk = new Collection; |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | while ($iterator->valid()) { |
1204 | - if (! $callback($iterator->current(), $iterator->key(), $chunk)) { |
|
1204 | + if (!$callback($iterator->current(), $iterator->key(), $chunk)) { |
|
1205 | 1205 | yield new static($chunk); |
1206 | 1206 | |
1207 | 1207 | $chunk = new Collection; |
@@ -1311,11 +1311,11 @@ discard block |
||
1311 | 1311 | return $this->passthru('take', func_get_args()); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | - return new static(function () use ($limit) { |
|
1314 | + return new static(function() use ($limit) { |
|
1315 | 1315 | $iterator = $this->getIterator(); |
1316 | 1316 | |
1317 | 1317 | while ($limit--) { |
1318 | - if (! $iterator->valid()) { |
|
1318 | + if (!$iterator->valid()) { |
|
1319 | 1319 | break; |
1320 | 1320 | } |
1321 | 1321 | |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | { |
1339 | 1339 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
1340 | 1340 | |
1341 | - return new static(function () use ($callback) { |
|
1341 | + return new static(function() use ($callback) { |
|
1342 | 1342 | foreach ($this as $key => $item) { |
1343 | 1343 | if ($callback($item, $key)) { |
1344 | 1344 | break; |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | { |
1360 | 1360 | $timeout = $timeout->getTimestamp(); |
1361 | 1361 | |
1362 | - return $this->takeWhile(function () use ($timeout) { |
|
1362 | + return $this->takeWhile(function() use ($timeout) { |
|
1363 | 1363 | return $this->now() < $timeout; |
1364 | 1364 | }); |
1365 | 1365 | } |
@@ -1374,8 +1374,8 @@ discard block |
||
1374 | 1374 | { |
1375 | 1375 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
1376 | 1376 | |
1377 | - return $this->takeUntil(function ($item, $key) use ($callback) { |
|
1378 | - return ! $callback($item, $key); |
|
1377 | + return $this->takeUntil(function($item, $key) use ($callback) { |
|
1378 | + return !$callback($item, $key); |
|
1379 | 1379 | }); |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | */ |
1388 | 1388 | public function tapEach(callable $callback) |
1389 | 1389 | { |
1390 | - return new static(function () use ($callback) { |
|
1390 | + return new static(function() use ($callback) { |
|
1391 | 1391 | foreach ($this as $key => $value) { |
1392 | 1392 | $callback($value, $key); |
1393 | 1393 | |
@@ -1417,11 +1417,11 @@ discard block |
||
1417 | 1417 | { |
1418 | 1418 | $callback = $this->valueRetriever($key); |
1419 | 1419 | |
1420 | - return new static(function () use ($callback, $strict) { |
|
1420 | + return new static(function() use ($callback, $strict) { |
|
1421 | 1421 | $exists = []; |
1422 | 1422 | |
1423 | 1423 | foreach ($this as $key => $item) { |
1424 | - if (! in_array($id = $callback($item, $key), $exists, $strict)) { |
|
1424 | + if (!in_array($id = $callback($item, $key), $exists, $strict)) { |
|
1425 | 1425 | yield $key => $item; |
1426 | 1426 | |
1427 | 1427 | $exists[] = $id; |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | */ |
1438 | 1438 | public function values() |
1439 | 1439 | { |
1440 | - return new static(function () { |
|
1440 | + return new static(function() { |
|
1441 | 1441 | foreach ($this as $item) { |
1442 | 1442 | yield $item; |
1443 | 1443 | } |
@@ -1457,8 +1457,8 @@ discard block |
||
1457 | 1457 | { |
1458 | 1458 | $iterables = func_get_args(); |
1459 | 1459 | |
1460 | - return new static(function () use ($iterables) { |
|
1461 | - $iterators = Collection::make($iterables)->map(function ($iterable) { |
|
1460 | + return new static(function() use ($iterables) { |
|
1461 | + $iterators = Collection::make($iterables)->map(function($iterable) { |
|
1462 | 1462 | return $this->makeIterator($iterable); |
1463 | 1463 | })->prepend($this->getIterator()); |
1464 | 1464 | |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | return $this->passthru('pad', func_get_args()); |
1484 | 1484 | } |
1485 | 1485 | |
1486 | - return new static(function () use ($size, $value) { |
|
1486 | + return new static(function() use ($size, $value) { |
|
1487 | 1487 | $yielded = 0; |
1488 | 1488 | |
1489 | 1489 | foreach ($this as $index => $item) { |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | */ |
1569 | 1569 | protected function passthru($method, array $params) |
1570 | 1570 | { |
1571 | - return new static(function () use ($method, $params) { |
|
1571 | + return new static(function() use ($method, $params) { |
|
1572 | 1572 | yield from $this->collect()->$method(...$params); |
1573 | 1573 | }); |
1574 | 1574 | } |