@@ -46,7 +46,7 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function toArray() |
| 48 | 48 | { |
| 49 | - return \array_map(function ($value) { |
|
| 49 | + return \array_map(function($value) { |
|
| 50 | 50 | if (\is_scalar($value)) { |
| 51 | 51 | return $value; |
| 52 | 52 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function negate(callable $fn) |
| 86 | 86 | { |
| 87 | - return function () use ($fn) { |
|
| 87 | + return function() use ($fn) { |
|
| 88 | 88 | return !\call_user_func_array($fn, \func_get_args()); |
| 89 | 89 | }; |
| 90 | 90 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return $fn; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - return function ($value) use ($fn) { |
|
| 105 | + return function($value) use ($fn) { |
|
| 106 | 106 | if (null === $fn) { |
| 107 | 107 | return $value; |
| 108 | 108 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | protected function matcher(array $props) |
| 234 | 234 | { |
| 235 | - return function ($value, $index) use ($props) { |
|
| 235 | + return function($value, $index) use ($props) { |
|
| 236 | 236 | foreach ($props as $prop => $criteria) { |
| 237 | 237 | if (\array_column([$value], $prop) != [$criteria]) { |
| 238 | 238 | return false; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | $fn = $this->valueFn($fn); |
| 283 | 283 | |
| 284 | - return $this->reduce(function ($carry, $value) use ($fn, $isMax) { |
|
| 284 | + return $this->reduce(function($carry, $value) use ($fn, $isMax) { |
|
| 285 | 285 | $value = $fn($value); |
| 286 | 286 | |
| 287 | 287 | if (!\is_numeric($value)) { |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | public function countBy($fn) |
| 382 | 382 | { |
| 383 | - return $this->group($fn, true)->map(function ($value) { |
|
| 383 | + return $this->group($fn, true)->map(function($value) { |
|
| 384 | 384 | return \count($value); |
| 385 | 385 | }); |
| 386 | 386 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $data = [[/* pass */], [/* fail */]]; |
| 420 | 420 | $fn = $this->valueFn($fn); |
| 421 | 421 | |
| 422 | - $this->each(function ($value, $index) use ($fn, &$data) { |
|
| 422 | + $this->each(function($value, $index) use ($fn, &$data) { |
|
| 423 | 423 | $data[$fn($value, $index) ? 0 : 1][] = $value; |
| 424 | 424 | }); |
| 425 | 425 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | static $memo = []; |
| 18 | 18 | |
| 19 | - return function () use (&$memo, $fn) { |
|
| 19 | + return function() use (&$memo, $fn) { |
|
| 20 | 20 | $hash = \md5(\json_encode($args = \func_get_args())); |
| 21 | 21 | |
| 22 | 22 | if (isset($memo[$hash])) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function delay(callable $fn, $wait) |
| 39 | 39 | { |
| 40 | - return function () use ($fn, $wait) { |
|
| 40 | + return function() use ($fn, $wait) { |
|
| 41 | 41 | \usleep(1000 * $wait); |
| 42 | 42 | |
| 43 | 43 | return \call_user_func_array($fn, \func_get_args()); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | static $previous = 0; |
| 59 | 59 | static $result = null; |
| 60 | 60 | |
| 61 | - return function () use ($fn, &$previous, &$result, &$wait) { |
|
| 61 | + return function() use ($fn, &$previous, &$result, &$wait) { |
|
| 62 | 62 | $now = $this->now(); |
| 63 | 63 | |
| 64 | 64 | if (!$previous) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $fns = \func_get_args(); |
| 94 | 94 | $start = \func_num_args() - 1; |
| 95 | 95 | |
| 96 | - return function () use ($fns, $start) { |
|
| 96 | + return function() use ($fns, $start) { |
|
| 97 | 97 | $i = $start; |
| 98 | 98 | $result = \call_user_func_array($fns[$start], \func_get_args()); |
| 99 | 99 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $ids = []; |
| 88 | 88 | $fn = $this->valueFn($fn); |
| 89 | 89 | |
| 90 | - return $this->filter(function ($value, $index) use ($fn, &$ids) { |
|
| 90 | + return $this->filter(function($value, $index) use ($fn, &$ids) { |
|
| 91 | 91 | return !isset($ids[$id = $fn($value, $index)]) ? $ids[$id] = true : false; |
| 92 | 92 | }); |
| 93 | 93 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $data = $this->asArray($data); |
| 105 | 105 | |
| 106 | - return $this->filter(function ($value) use ($data) { |
|
| 106 | + return $this->filter(function($value) use ($data) { |
|
| 107 | 107 | return !\in_array($value, $data); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $data = $this->asArray($data); |
| 133 | 133 | |
| 134 | - return $this->filter(function ($value) use ($data) { |
|
| 134 | + return $this->filter(function($value) use ($data) { |
|
| 135 | 135 | return \in_array($value, $data); |
| 136 | 136 | }); |
| 137 | 137 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $data = $this->asArray($data); |
| 149 | 149 | |
| 150 | - return $this->map(function ($value, $index) use ($data) { |
|
| 150 | + return $this->map(function($value, $index) use ($data) { |
|
| 151 | 151 | return [$value, isset($data[$index]) ? $data[$index] : null]; |
| 152 | 152 | }); |
| 153 | 153 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function object($className = null) |
| 163 | 163 | { |
| 164 | - return $this->map(function ($value, $index) use ($className) { |
|
| 164 | + return $this->map(function($value, $index) use ($className) { |
|
| 165 | 165 | return $className ? new $className($value, $index) : (object) \compact('value', 'index'); |
| 166 | 166 | }); |
| 167 | 167 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function constant($value) |
| 37 | 37 | { |
| 38 | - return function () use ($value) { |
|
| 38 | + return function() use ($value) { |
|
| 39 | 39 | return $value; |
| 40 | 40 | }; |
| 41 | 41 | } |
@@ -29,14 +29,14 @@ |
||
| 29 | 29 | |
| 30 | 30 | public function __call($method, $args) |
| 31 | 31 | { |
| 32 | - return $this->underscore->{$this->method}(function ($item) use ($method, $args) { |
|
| 32 | + return $this->underscore->{$this->method}(function($item) use ($method, $args) { |
|
| 33 | 33 | return \call_user_func_array([$item, $method], $args); |
| 34 | 34 | }); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function __get($prop) |
| 38 | 38 | { |
| 39 | - return $this->underscore->{$this->method}(function ($item) use ($prop) { |
|
| 39 | + return $this->underscore->{$this->method}(function($item) use ($prop) { |
|
| 40 | 40 | $props = \array_column([$item], $prop); |
| 41 | 41 | |
| 42 | 42 | return $props ? $props[0] : null; |