@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Arrayy; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Arrayy; |
6 | 6 |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
612 | - * @param mixed $path |
|
613 | - * @param \callable $callable |
|
612 | + * @param string $path |
|
613 | + * @param \Closure $callable |
|
614 | 614 | * @param null|array $currentOffset |
615 | 615 | */ |
616 | 616 | protected function callAtPath($path, $callable, &$currentOffset = null) |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | } |
1764 | 1764 | |
1765 | 1765 | /** |
1766 | - * @param mixed $glue |
|
1766 | + * @param string $glue |
|
1767 | 1767 | * @param string|array|static $pieces |
1768 | 1768 | * @param bool $useKeys |
1769 | 1769 | * |
@@ -3639,7 +3639,7 @@ discard block |
||
3639 | 3639 | /** |
3640 | 3640 | * Apply the given function to every element in the array, discarding the results. |
3641 | 3641 | * |
3642 | - * @param \callable $callable |
|
3642 | + * @param \Closure $callable |
|
3643 | 3643 | * @param bool $recursive <p>Whether array will be walked recursively or no</p> |
3644 | 3644 | * |
3645 | 3645 | * @return static <p>(Mutable) Return this Arrayy object, with modified elements.</p> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Arrayy; |
6 | 6 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
84 | - return (array)$this->array; |
|
84 | + return (array) $this->array; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | // php cast "bool"-index into "int"-index |
299 | - if ((bool)$offset === $offset) { |
|
300 | - $offset = (int)$offset; |
|
299 | + if ((bool) $offset === $offset) { |
|
300 | + $offset = (int) $offset; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | $tmpReturn = \array_key_exists($offset, $this->array); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ( |
309 | 309 | $tmpReturn === false |
310 | 310 | && |
311 | - \strpos((string)$offset, $this->pathSeparator) === false |
|
311 | + \strpos((string) $offset, $this->pathSeparator) === false |
|
312 | 312 | ) |
313 | 313 | ) { |
314 | 314 | return $tmpReturn; |
@@ -316,16 +316,16 @@ discard block |
||
316 | 316 | |
317 | 317 | $offsetExists = false; |
318 | 318 | |
319 | - if (\strpos((string)$offset, $this->pathSeparator) !== false) { |
|
319 | + if (\strpos((string) $offset, $this->pathSeparator) !== false) { |
|
320 | 320 | |
321 | 321 | $offsetExists = false; |
322 | - $explodedPath = \explode($this->pathSeparator, (string)$offset); |
|
322 | + $explodedPath = \explode($this->pathSeparator, (string) $offset); |
|
323 | 323 | $lastOffset = \array_pop($explodedPath); |
324 | 324 | $containerPath = \implode($this->pathSeparator, $explodedPath); |
325 | 325 | |
326 | 326 | $this->callAtPath( |
327 | 327 | $containerPath, |
328 | - function ($container) use ($lastOffset, &$offsetExists) { |
|
328 | + function($container) use ($lastOffset, &$offsetExists) { |
|
329 | 329 | $offsetExists = \array_key_exists($lastOffset, $container); |
330 | 330 | } |
331 | 331 | ); |
@@ -378,14 +378,14 @@ discard block |
||
378 | 378 | return; |
379 | 379 | } |
380 | 380 | |
381 | - if (\strpos((string)$offset, $this->pathSeparator) !== false) { |
|
381 | + if (\strpos((string) $offset, $this->pathSeparator) !== false) { |
|
382 | 382 | |
383 | - $path = \explode($this->pathSeparator, (string)$offset); |
|
383 | + $path = \explode($this->pathSeparator, (string) $offset); |
|
384 | 384 | $pathToUnset = \array_pop($path); |
385 | 385 | |
386 | 386 | $this->callAtPath( |
387 | 387 | \implode($this->pathSeparator, $path), |
388 | - function (&$offset) use ($pathToUnset) { |
|
388 | + function(&$offset) use ($pathToUnset) { |
|
389 | 389 | unset($offset[$pathToUnset]); |
390 | 390 | } |
391 | 391 | ); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | if (\strpos($class, '\\') === 0) { |
424 | - $class = '\\' . $class; |
|
424 | + $class = '\\'.$class; |
|
425 | 425 | if (\class_exists($class)) { |
426 | 426 | $this->iteratorClass = $class; |
427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
432 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
@@ -494,11 +494,11 @@ discard block |
||
494 | 494 | $result = []; |
495 | 495 | foreach ($this->array as $key => $item) { |
496 | 496 | if ($item instanceof self) { |
497 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
497 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
498 | 498 | } elseif (\is_array($item)) { |
499 | - $result[$prefix . $key] = self::create($item)->appendToEachKey($prefix)->toArray(); |
|
499 | + $result[$prefix.$key] = self::create($item)->appendToEachKey($prefix)->toArray(); |
|
500 | 500 | } else { |
501 | - $result[$prefix . $key] = $item; |
|
501 | + $result[$prefix.$key] = $item; |
|
502 | 502 | } |
503 | 503 | } |
504 | 504 | |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | } elseif (\is_object($item)) { |
524 | 524 | $result[$key] = $item; |
525 | 525 | } else { |
526 | - $result[$key] = $prefix . $item; |
|
526 | + $result[$key] = $prefix.$item; |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
@@ -689,8 +689,8 @@ discard block |
||
689 | 689 | public function clean() |
690 | 690 | { |
691 | 691 | return $this->filter( |
692 | - function ($value) { |
|
693 | - return (bool)$value; |
|
692 | + function($value) { |
|
693 | + return (bool) $value; |
|
694 | 694 | } |
695 | 695 | ); |
696 | 696 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | return $this->in_array_recursive( |
782 | 782 | UTF8::strtoupper($value), |
783 | 783 | $this->walk( |
784 | - function (&$val) { |
|
784 | + function(&$val) { |
|
785 | 785 | $val = UTF8::strtoupper($val); |
786 | 786 | }, |
787 | 787 | true |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | return \in_array( |
794 | 794 | UTF8::strtoupper($value), |
795 | 795 | $this->walk( |
796 | - function (&$val) { |
|
796 | + function(&$val) { |
|
797 | 797 | $val = UTF8::strtoupper($val); |
798 | 798 | }, |
799 | 799 | false |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | // trim all string in the array |
998 | 998 | \array_walk( |
999 | 999 | $array, |
1000 | - function (&$val) { |
|
1000 | + function(&$val) { |
|
1001 | 1001 | /** @noinspection ReferenceMismatchInspection */ |
1002 | 1002 | if (\is_string($val)) { |
1003 | 1003 | $val = \trim($val); |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | if ($isObject && \method_exists($array, '__toArray')) { |
1239 | - return (array)$array->__toArray(); |
|
1239 | + return (array) $array->__toArray(); |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | /** @noinspection ReferenceMismatchInspection */ |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | || |
1246 | 1246 | ($isObject && \method_exists($array, '__toString')) |
1247 | 1247 | ) { |
1248 | - return [(string)$array]; |
|
1248 | + return [(string) $array]; |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | throw new \InvalidArgumentException( |
@@ -1321,54 +1321,54 @@ discard block |
||
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | $ops = [ |
1324 | - 'eq' => function ($item, $prop, $value) { |
|
1324 | + 'eq' => function($item, $prop, $value) { |
|
1325 | 1325 | return $item[$prop] === $value; |
1326 | 1326 | }, |
1327 | - 'gt' => function ($item, $prop, $value) { |
|
1327 | + 'gt' => function($item, $prop, $value) { |
|
1328 | 1328 | return $item[$prop] > $value; |
1329 | 1329 | }, |
1330 | - 'ge' => function ($item, $prop, $value) { |
|
1330 | + 'ge' => function($item, $prop, $value) { |
|
1331 | 1331 | return $item[$prop] >= $value; |
1332 | 1332 | }, |
1333 | - 'gte' => function ($item, $prop, $value) { |
|
1333 | + 'gte' => function($item, $prop, $value) { |
|
1334 | 1334 | return $item[$prop] >= $value; |
1335 | 1335 | }, |
1336 | - 'lt' => function ($item, $prop, $value) { |
|
1336 | + 'lt' => function($item, $prop, $value) { |
|
1337 | 1337 | return $item[$prop] < $value; |
1338 | 1338 | }, |
1339 | - 'le' => function ($item, $prop, $value) { |
|
1339 | + 'le' => function($item, $prop, $value) { |
|
1340 | 1340 | return $item[$prop] <= $value; |
1341 | 1341 | }, |
1342 | - 'lte' => function ($item, $prop, $value) { |
|
1342 | + 'lte' => function($item, $prop, $value) { |
|
1343 | 1343 | return $item[$prop] <= $value; |
1344 | 1344 | }, |
1345 | - 'ne' => function ($item, $prop, $value) { |
|
1345 | + 'ne' => function($item, $prop, $value) { |
|
1346 | 1346 | return $item[$prop] !== $value; |
1347 | 1347 | }, |
1348 | - 'contains' => function ($item, $prop, $value) { |
|
1349 | - return \in_array($item[$prop], (array)$value, true); |
|
1348 | + 'contains' => function($item, $prop, $value) { |
|
1349 | + return \in_array($item[$prop], (array) $value, true); |
|
1350 | 1350 | }, |
1351 | - 'notContains' => function ($item, $prop, $value) { |
|
1352 | - return !\in_array($item[$prop], (array)$value, true); |
|
1351 | + 'notContains' => function($item, $prop, $value) { |
|
1352 | + return !\in_array($item[$prop], (array) $value, true); |
|
1353 | 1353 | }, |
1354 | - 'newer' => function ($item, $prop, $value) { |
|
1354 | + 'newer' => function($item, $prop, $value) { |
|
1355 | 1355 | return \strtotime($item[$prop]) > \strtotime($value); |
1356 | 1356 | }, |
1357 | - 'older' => function ($item, $prop, $value) { |
|
1357 | + 'older' => function($item, $prop, $value) { |
|
1358 | 1358 | return \strtotime($item[$prop]) < \strtotime($value); |
1359 | 1359 | }, |
1360 | 1360 | ]; |
1361 | 1361 | |
1362 | 1362 | $result = \array_values( |
1363 | 1363 | \array_filter( |
1364 | - (array)$this->array, |
|
1365 | - function ($item) use ( |
|
1364 | + (array) $this->array, |
|
1365 | + function($item) use ( |
|
1366 | 1366 | $property, |
1367 | 1367 | $value, |
1368 | 1368 | $ops, |
1369 | 1369 | $comparisonOp |
1370 | 1370 | ) { |
1371 | - $item = (array)$item; |
|
1371 | + $item = (array) $item; |
|
1372 | 1372 | $itemArrayy = new Arrayy($item); |
1373 | 1373 | $item[$property] = $itemArrayy->get($property, []); |
1374 | 1374 | |
@@ -1441,9 +1441,9 @@ discard block |
||
1441 | 1441 | { |
1442 | 1442 | if ($number === null) { |
1443 | 1443 | $arrayTmp = $this->array; |
1444 | - $array = (array)\array_shift($arrayTmp); |
|
1444 | + $array = (array) \array_shift($arrayTmp); |
|
1445 | 1445 | } else { |
1446 | - $number = (int)$number; |
|
1446 | + $number = (int) $number; |
|
1447 | 1447 | $arrayTmp = $this->array; |
1448 | 1448 | $array = \array_splice($arrayTmp, 0, $number, true); |
1449 | 1449 | } |
@@ -1461,9 +1461,9 @@ discard block |
||
1461 | 1461 | public function firstsMutable(int $number = null) |
1462 | 1462 | { |
1463 | 1463 | if ($number === null) { |
1464 | - $this->array = (array)\array_shift($this->array); |
|
1464 | + $this->array = (array) \array_shift($this->array); |
|
1465 | 1465 | } else { |
1466 | - $number = (int)$number; |
|
1466 | + $number = (int) $number; |
|
1467 | 1467 | $this->array = \array_splice($this->array, 0, $number, true); |
1468 | 1468 | } |
1469 | 1469 | |
@@ -1505,8 +1505,8 @@ discard block |
||
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | // php cast "bool"-index into "int"-index |
1508 | - if ((bool)$key === $key) { |
|
1509 | - $key = (int)$key; |
|
1508 | + if ((bool) $key === $key) { |
|
1509 | + $key = (int) $key; |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | if (\array_key_exists($key, $usedArray) === true) { |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | // Crawl through array, get key according to object or not |
1521 | - foreach (\explode($this->pathSeparator, (string)$key) as $segment) { |
|
1521 | + foreach (\explode($this->pathSeparator, (string) $key) as $segment) { |
|
1522 | 1522 | if (!isset($usedArray[$segment])) { |
1523 | 1523 | return $fallback instanceof \Closure ? $fallback() : $fallback; |
1524 | 1524 | } |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | */ |
1691 | 1691 | public function group($grouper, bool $saveKeys = false) |
1692 | 1692 | { |
1693 | - $array = (array)$this->array; |
|
1693 | + $array = (array) $this->array; |
|
1694 | 1694 | $result = []; |
1695 | 1695 | |
1696 | 1696 | // Iterate over values, group by property/results from closure |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | ); |
1790 | 1790 | } |
1791 | 1791 | |
1792 | - return (string)$pieces; |
|
1792 | + return (string) $pieces; |
|
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | /** |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | */ |
1875 | 1875 | protected function internalRemove($key): bool |
1876 | 1876 | { |
1877 | - $path = \explode($this->pathSeparator, (string)$key); |
|
1877 | + $path = \explode($this->pathSeparator, (string) $key); |
|
1878 | 1878 | |
1879 | 1879 | // Crawl though the keys |
1880 | 1880 | while (\count($path) > 1) { |
@@ -1909,8 +1909,8 @@ discard block |
||
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | // init |
1912 | - $array =& $this->array; |
|
1913 | - $path = \explode($this->pathSeparator, (string)$key); |
|
1912 | + $array = & $this->array; |
|
1913 | + $path = \explode($this->pathSeparator, (string) $key); |
|
1914 | 1914 | |
1915 | 1915 | // Crawl through the keys |
1916 | 1916 | while (\count($path) > 1) { |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | $array[$key] = static::create([]); |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $array =& $array[$key]; |
|
1926 | + $array = & $array[$key]; |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | $array[\array_shift($path)] = $value; |
@@ -2204,12 +2204,12 @@ discard block |
||
2204 | 2204 | if ($poppedValue === null) { |
2205 | 2205 | $poppedValue = [$poppedValue]; |
2206 | 2206 | } else { |
2207 | - $poppedValue = (array)$poppedValue; |
|
2207 | + $poppedValue = (array) $poppedValue; |
|
2208 | 2208 | } |
2209 | 2209 | |
2210 | 2210 | $arrayy = static::create($poppedValue); |
2211 | 2211 | } else { |
2212 | - $number = (int)$number; |
|
2212 | + $number = (int) $number; |
|
2213 | 2213 | $arrayy = $this->rest(-$number); |
2214 | 2214 | } |
2215 | 2215 | |
@@ -2235,12 +2235,12 @@ discard block |
||
2235 | 2235 | if ($poppedValue === null) { |
2236 | 2236 | $poppedValue = [$poppedValue]; |
2237 | 2237 | } else { |
2238 | - $poppedValue = (array)$poppedValue; |
|
2238 | + $poppedValue = (array) $poppedValue; |
|
2239 | 2239 | } |
2240 | 2240 | |
2241 | 2241 | $this->array = static::create($poppedValue)->array; |
2242 | 2242 | } else { |
2243 | - $number = (int)$number; |
|
2243 | + $number = (int) $number; |
|
2244 | 2244 | $this->array = $this->rest(-$number)->array; |
2245 | 2245 | } |
2246 | 2246 | |
@@ -2579,7 +2579,7 @@ discard block |
||
2579 | 2579 | } elseif (\is_array($item)) { |
2580 | 2580 | $result[$key] = self::create($item)->prependToEachKey($suffix)->toArray(); |
2581 | 2581 | } else { |
2582 | - $result[$key . $suffix] = $item; |
|
2582 | + $result[$key.$suffix] = $item; |
|
2583 | 2583 | } |
2584 | 2584 | |
2585 | 2585 | } |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | } elseif (\is_object($item)) { |
2606 | 2606 | $result[$key] = $item; |
2607 | 2607 | } else { |
2608 | - $result[$key] = $item . $suffix; |
|
2608 | + $result[$key] = $item.$suffix; |
|
2609 | 2609 | } |
2610 | 2610 | } |
2611 | 2611 | |
@@ -2693,7 +2693,7 @@ discard block |
||
2693 | 2693 | ); |
2694 | 2694 | } |
2695 | 2695 | |
2696 | - $result = (array)\array_rand($this->array, $number); |
|
2696 | + $result = (array) \array_rand($this->array, $number); |
|
2697 | 2697 | |
2698 | 2698 | return static::create($result); |
2699 | 2699 | } |
@@ -2790,7 +2790,7 @@ discard block |
||
2790 | 2790 | if ($result === null) { |
2791 | 2791 | $this->array = []; |
2792 | 2792 | } else { |
2793 | - $this->array = (array)$result; |
|
2793 | + $this->array = (array) $result; |
|
2794 | 2794 | } |
2795 | 2795 | |
2796 | 2796 | return static::create($this->array); |
@@ -2916,7 +2916,7 @@ discard block |
||
2916 | 2916 | return new static(); |
2917 | 2917 | } |
2918 | 2918 | |
2919 | - return static::create(\array_fill(0, (int)$times, $this->array)); |
|
2919 | + return static::create(\array_fill(0, (int) $times, $this->array)); |
|
2920 | 2920 | } |
2921 | 2921 | |
2922 | 2922 | /** |
@@ -3009,7 +3009,7 @@ discard block |
||
3009 | 3009 | public function replaceValues($search, $replacement = '') |
3010 | 3010 | { |
3011 | 3011 | $array = $this->each( |
3012 | - function ($value) use ($search, $replacement) { |
|
3012 | + function($value) use ($search, $replacement) { |
|
3013 | 3013 | return UTF8::str_replace($search, $replacement, $value); |
3014 | 3014 | } |
3015 | 3015 | ); |
@@ -3090,8 +3090,8 @@ discard block |
||
3090 | 3090 | } |
3091 | 3091 | |
3092 | 3092 | // php cast "bool"-index into "int"-index |
3093 | - if ((bool)$index === $index) { |
|
3094 | - $index = (int)$index; |
|
3093 | + if ((bool) $index === $index) { |
|
3094 | + $index = (int) $index; |
|
3095 | 3095 | } |
3096 | 3096 | |
3097 | 3097 | if (\array_key_exists($index, $this->array) === true) { |
@@ -3351,7 +3351,7 @@ discard block |
||
3351 | 3351 | */ |
3352 | 3352 | public function sorter($sorter = null, $direction = SORT_ASC, int $strategy = SORT_REGULAR) |
3353 | 3353 | { |
3354 | - $array = (array)$this->array; |
|
3354 | + $array = (array) $this->array; |
|
3355 | 3355 | $direction = $this->getDirection($direction); |
3356 | 3356 | |
3357 | 3357 | // Transform all values into their results. |
@@ -3360,7 +3360,7 @@ discard block |
||
3360 | 3360 | |
3361 | 3361 | $that = $this; |
3362 | 3362 | $results = $arrayy->each( |
3363 | - function ($value) use ($sorter, $that) { |
|
3363 | + function($value) use ($sorter, $that) { |
|
3364 | 3364 | return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
3365 | 3365 | } |
3366 | 3366 | ); |
@@ -3458,8 +3458,8 @@ discard block |
||
3458 | 3458 | if ($arrayCount === 0) { |
3459 | 3459 | $result = []; |
3460 | 3460 | } else { |
3461 | - $numberOfPieces = (int)$numberOfPieces; |
|
3462 | - $splitSize = (int)\ceil($arrayCount / $numberOfPieces); |
|
3461 | + $numberOfPieces = (int) $numberOfPieces; |
|
3462 | + $splitSize = (int) \ceil($arrayCount / $numberOfPieces); |
|
3463 | 3463 | $result = \array_chunk($this->array, $splitSize, $keepKeys); |
3464 | 3464 | } |
3465 | 3465 | |
@@ -3474,12 +3474,12 @@ discard block |
||
3474 | 3474 | public function stripEmpty() |
3475 | 3475 | { |
3476 | 3476 | return $this->filter( |
3477 | - function ($item) { |
|
3477 | + function($item) { |
|
3478 | 3478 | if ($item === null) { |
3479 | 3479 | return false; |
3480 | 3480 | } |
3481 | 3481 | |
3482 | - return (bool)\trim((string)$item); |
|
3482 | + return (bool) \trim((string) $item); |
|
3483 | 3483 | } |
3484 | 3484 | ); |
3485 | 3485 | } |
@@ -3547,7 +3547,7 @@ discard block |
||
3547 | 3547 | |
3548 | 3548 | $this->array = \array_reduce( |
3549 | 3549 | $this->array, |
3550 | - function ($resultArray, $value) { |
|
3550 | + function($resultArray, $value) { |
|
3551 | 3551 | if (!\in_array($value, $resultArray, true)) { |
3552 | 3552 | $resultArray[] = $value; |
3553 | 3553 | } |
@@ -3560,7 +3560,7 @@ discard block |
||
3560 | 3560 | if ($this->array === null) { |
3561 | 3561 | $this->array = []; |
3562 | 3562 | } else { |
3563 | - $this->array = (array)$this->array; |
|
3563 | + $this->array = (array) $this->array; |
|
3564 | 3564 | } |
3565 | 3565 | |
3566 | 3566 | return $this; |
@@ -3580,7 +3580,7 @@ discard block |
||
3580 | 3580 | |
3581 | 3581 | $this->array = \array_reduce( |
3582 | 3582 | \array_keys($array), |
3583 | - function ($resultArray, $key) use ($array) { |
|
3583 | + function($resultArray, $key) use ($array) { |
|
3584 | 3584 | if (!\in_array($array[$key], $resultArray, true)) { |
3585 | 3585 | $resultArray[$key] = $array[$key]; |
3586 | 3586 | } |
@@ -3593,7 +3593,7 @@ discard block |
||
3593 | 3593 | if ($this->array === null) { |
3594 | 3594 | $this->array = []; |
3595 | 3595 | } else { |
3596 | - $this->array = (array)$this->array; |
|
3596 | + $this->array = (array) $this->array; |
|
3597 | 3597 | } |
3598 | 3598 | |
3599 | 3599 | return $this; |
@@ -3633,7 +3633,7 @@ discard block |
||
3633 | 3633 | */ |
3634 | 3634 | public function values() |
3635 | 3635 | { |
3636 | - return static::create(\array_values((array)$this->array)); |
|
3636 | + return static::create(\array_values((array) $this->array)); |
|
3637 | 3637 | } |
3638 | 3638 | |
3639 | 3639 | /** |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Arrayy; |
6 | 6 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | if (!isset(static::$methodArgs[$name])) { |
46 | - throw new \BadMethodCallException($name . ' is not a valid method'); |
|
46 | + throw new \BadMethodCallException($name.' is not a valid method'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $numArgs = \count($arguments); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function repeat($data, $times): Arrayy |
105 | 105 | { |
106 | - $times = (int)$times; |
|
106 | + $times = (int) $times; |
|
107 | 107 | |
108 | 108 | if ($times === 0 || empty($data)) { |
109 | 109 | return Arrayy::create(); |