@@ -956,25 +956,25 @@ discard block |
||
956 | 956 | { |
957 | 957 | if ($recursive === true) { |
958 | 958 | return \count( |
959 | - \array_intersect($needles, $this->keys(true)->getArray()), |
|
960 | - \COUNT_RECURSIVE |
|
961 | - ) |
|
962 | - === |
|
963 | - \count( |
|
964 | - $needles, |
|
965 | - \COUNT_RECURSIVE |
|
966 | - ); |
|
959 | + \array_intersect($needles, $this->keys(true)->getArray()), |
|
960 | + \COUNT_RECURSIVE |
|
961 | + ) |
|
962 | + === |
|
963 | + \count( |
|
964 | + $needles, |
|
965 | + \COUNT_RECURSIVE |
|
966 | + ); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | return \count( |
970 | - \array_intersect($needles, $this->keys()->getArray()), |
|
971 | - \COUNT_NORMAL |
|
972 | - ) |
|
973 | - === |
|
974 | - \count( |
|
975 | - $needles, |
|
976 | - \COUNT_NORMAL |
|
977 | - ); |
|
970 | + \array_intersect($needles, $this->keys()->getArray()), |
|
971 | + \COUNT_NORMAL |
|
972 | + ) |
|
973 | + === |
|
974 | + \count( |
|
975 | + $needles, |
|
976 | + \COUNT_NORMAL |
|
977 | + ); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | /** |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | public function containsValues(array $needles): bool |
1030 | 1030 | { |
1031 | 1031 | return \count(\array_intersect($needles, $this->getArray()), \COUNT_NORMAL) |
1032 | - === |
|
1033 | - \count($needles, \COUNT_NORMAL); |
|
1032 | + === |
|
1033 | + \count($needles, \COUNT_NORMAL); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | /** |
@@ -2236,15 +2236,15 @@ discard block |
||
2236 | 2236 | |
2237 | 2237 | if ($recursive === true) { |
2238 | 2238 | return $this->array_keys_recursive($this->getArray()) |
2239 | - === |
|
2240 | - \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2239 | + === |
|
2240 | + \range(0, \count($this->getArray(), \COUNT_RECURSIVE) - 1); |
|
2241 | 2241 | } |
2242 | 2242 | |
2243 | 2243 | // non recursive |
2244 | 2244 | |
2245 | 2245 | return \array_keys($this->getArray()) |
2246 | - === |
|
2247 | - \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2246 | + === |
|
2247 | + \range(0, \count($this->getArray(), \COUNT_NORMAL) - 1); |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | /** |
@@ -2777,7 +2777,7 @@ discard block |
||
2777 | 2777 | $this->iteratorClass, |
2778 | 2778 | false |
2779 | 2779 | )->prependToEachKey($suffix) |
2780 | - ->toArray(); |
|
2780 | + ->toArray(); |
|
2781 | 2781 | } else { |
2782 | 2782 | $result[$key . $suffix] = $item; |
2783 | 2783 | } |
@@ -2812,7 +2812,7 @@ discard block |
||
2812 | 2812 | $this->iteratorClass, |
2813 | 2813 | false |
2814 | 2814 | )->prependToEachValue($suffix) |
2815 | - ->toArray(); |
|
2815 | + ->toArray(); |
|
2816 | 2816 | } elseif (\is_object($item)) { |
2817 | 2817 | $result[$key] = $item; |
2818 | 2818 | } else { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | && |
105 | 105 | \count(\array_diff_key($this->properties, $array)) > 0 |
106 | 106 | ) { |
107 | - throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($array), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
107 | + throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($array), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
108 | 108 | }; |
109 | 109 | |
110 | 110 | foreach ($array as $key => &$value) { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | $this->callAtPath( |
453 | 453 | $containerPath, |
454 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
454 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
455 | 455 | $offsetExists = \array_key_exists($lastOffset, $container); |
456 | 456 | } |
457 | 457 | ); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | $this->callAtPath( |
517 | 517 | \implode($this->pathSeparator, $path), |
518 | - static function (&$offset) use ($pathToUnset) { |
|
518 | + static function(&$offset) use ($pathToUnset) { |
|
519 | 519 | unset($offset[$pathToUnset]); |
520 | 520 | } |
521 | 521 | ); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | if (\strpos($class, '\\') === 0) { |
555 | - $class = '\\' . $class; |
|
555 | + $class = '\\'.$class; |
|
556 | 556 | if (\class_exists($class)) { |
557 | 557 | $this->iteratorClass = $class; |
558 | 558 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
563 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
563 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -668,13 +668,13 @@ discard block |
||
668 | 668 | |
669 | 669 | foreach ($this->getGenerator() as $key => $item) { |
670 | 670 | if ($item instanceof self) { |
671 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
671 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
672 | 672 | } elseif (\is_array($item)) { |
673 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
673 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
674 | 674 | ->appendToEachKey($prefix) |
675 | 675 | ->toArray(); |
676 | 676 | } else { |
677 | - $result[$prefix . $key] = $item; |
|
677 | + $result[$prefix.$key] = $item; |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | } elseif (\is_object($item)) { |
703 | 703 | $result[$key] = $item; |
704 | 704 | } else { |
705 | - $result[$key] = $prefix . $item; |
|
705 | + $result[$key] = $prefix.$item; |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | public function clean(): self |
854 | 854 | { |
855 | 855 | return $this->filter( |
856 | - static function ($value) { |
|
856 | + static function($value) { |
|
857 | 857 | return (bool) $value; |
858 | 858 | } |
859 | 859 | ); |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | return $this->in_array_recursive( |
907 | 907 | \mb_strtoupper((string) $value), |
908 | 908 | $this->walk( |
909 | - static function (&$val) { |
|
909 | + static function(&$val) { |
|
910 | 910 | /** @noinspection PhpComposerExtensionStubsInspection */ |
911 | 911 | $val = \mb_strtoupper((string) $val); |
912 | 912 | }, |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | return \in_array( |
921 | 921 | \mb_strtoupper((string) $value), |
922 | 922 | $this->walk( |
923 | - static function (&$val) { |
|
923 | + static function(&$val) { |
|
924 | 924 | /** @noinspection PhpComposerExtensionStubsInspection */ |
925 | 925 | $val = \mb_strtoupper((string) $val); |
926 | 926 | }, |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | // trim all string in the array |
1201 | 1201 | \array_walk( |
1202 | 1202 | $array, |
1203 | - static function (&$val) { |
|
1203 | + static function(&$val) { |
|
1204 | 1204 | if (\is_string($val)) { |
1205 | 1205 | $val = \trim($val); |
1206 | 1206 | } |
@@ -1528,40 +1528,40 @@ discard block |
||
1528 | 1528 | } |
1529 | 1529 | |
1530 | 1530 | $ops = [ |
1531 | - 'eq' => static function ($item, $prop, $value) { |
|
1531 | + 'eq' => static function($item, $prop, $value) { |
|
1532 | 1532 | return $item[$prop] === $value; |
1533 | 1533 | }, |
1534 | - 'gt' => static function ($item, $prop, $value) { |
|
1534 | + 'gt' => static function($item, $prop, $value) { |
|
1535 | 1535 | return $item[$prop] > $value; |
1536 | 1536 | }, |
1537 | - 'ge' => static function ($item, $prop, $value) { |
|
1537 | + 'ge' => static function($item, $prop, $value) { |
|
1538 | 1538 | return $item[$prop] >= $value; |
1539 | 1539 | }, |
1540 | - 'gte' => static function ($item, $prop, $value) { |
|
1540 | + 'gte' => static function($item, $prop, $value) { |
|
1541 | 1541 | return $item[$prop] >= $value; |
1542 | 1542 | }, |
1543 | - 'lt' => static function ($item, $prop, $value) { |
|
1543 | + 'lt' => static function($item, $prop, $value) { |
|
1544 | 1544 | return $item[$prop] < $value; |
1545 | 1545 | }, |
1546 | - 'le' => static function ($item, $prop, $value) { |
|
1546 | + 'le' => static function($item, $prop, $value) { |
|
1547 | 1547 | return $item[$prop] <= $value; |
1548 | 1548 | }, |
1549 | - 'lte' => static function ($item, $prop, $value) { |
|
1549 | + 'lte' => static function($item, $prop, $value) { |
|
1550 | 1550 | return $item[$prop] <= $value; |
1551 | 1551 | }, |
1552 | - 'ne' => static function ($item, $prop, $value) { |
|
1552 | + 'ne' => static function($item, $prop, $value) { |
|
1553 | 1553 | return $item[$prop] !== $value; |
1554 | 1554 | }, |
1555 | - 'contains' => static function ($item, $prop, $value) { |
|
1555 | + 'contains' => static function($item, $prop, $value) { |
|
1556 | 1556 | return \in_array($item[$prop], (array) $value, true); |
1557 | 1557 | }, |
1558 | - 'notContains' => static function ($item, $prop, $value) { |
|
1558 | + 'notContains' => static function($item, $prop, $value) { |
|
1559 | 1559 | return !\in_array($item[$prop], (array) $value, true); |
1560 | 1560 | }, |
1561 | - 'newer' => static function ($item, $prop, $value) { |
|
1561 | + 'newer' => static function($item, $prop, $value) { |
|
1562 | 1562 | return \strtotime($item[$prop]) > \strtotime($value); |
1563 | 1563 | }, |
1564 | - 'older' => static function ($item, $prop, $value) { |
|
1564 | + 'older' => static function($item, $prop, $value) { |
|
1565 | 1565 | return \strtotime($item[$prop]) < \strtotime($value); |
1566 | 1566 | }, |
1567 | 1567 | ]; |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | $result = \array_values( |
1570 | 1570 | \array_filter( |
1571 | 1571 | $this->getArray(), |
1572 | - static function ($item) use ( |
|
1572 | + static function($item) use ( |
|
1573 | 1573 | $property, |
1574 | 1574 | $value, |
1575 | 1575 | $ops, |
@@ -2779,7 +2779,7 @@ discard block |
||
2779 | 2779 | )->prependToEachKey($suffix) |
2780 | 2780 | ->toArray(); |
2781 | 2781 | } else { |
2782 | - $result[$key . $suffix] = $item; |
|
2782 | + $result[$key.$suffix] = $item; |
|
2783 | 2783 | } |
2784 | 2784 | } |
2785 | 2785 | |
@@ -2816,7 +2816,7 @@ discard block |
||
2816 | 2816 | } elseif (\is_object($item)) { |
2817 | 2817 | $result[$key] = $item; |
2818 | 2818 | } else { |
2819 | - $result[$key] = $item . $suffix; |
|
2819 | + $result[$key] = $item.$suffix; |
|
2820 | 2820 | } |
2821 | 2821 | } |
2822 | 2822 | |
@@ -3046,7 +3046,7 @@ discard block |
||
3046 | 3046 | if ($this->generator) { |
3047 | 3047 | $result = $init; |
3048 | 3048 | |
3049 | - foreach($this->getGenerator() as $value) { |
|
3049 | + foreach ($this->getGenerator() as $value) { |
|
3050 | 3050 | $result = $callable($result, $value); |
3051 | 3051 | } |
3052 | 3052 | |
@@ -3347,7 +3347,7 @@ discard block |
||
3347 | 3347 | public function replaceValues($search, $replacement = ''): self |
3348 | 3348 | { |
3349 | 3349 | $array = $this->each( |
3350 | - static function ($value) use ($search, $replacement) { |
|
3350 | + static function($value) use ($search, $replacement) { |
|
3351 | 3351 | return \str_replace($search, $replacement, $value); |
3352 | 3352 | } |
3353 | 3353 | ); |
@@ -3751,7 +3751,7 @@ discard block |
||
3751 | 3751 | |
3752 | 3752 | $that = $this; |
3753 | 3753 | $results = $arrayy->each( |
3754 | - static function ($value) use ($sorter, $that) { |
|
3754 | + static function($value) use ($sorter, $that) { |
|
3755 | 3755 | return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
3756 | 3756 | } |
3757 | 3757 | ); |
@@ -3809,7 +3809,7 @@ discard block |
||
3809 | 3809 | public function stripEmpty(): self |
3810 | 3810 | { |
3811 | 3811 | return $this->filter( |
3812 | - static function ($item) { |
|
3812 | + static function($item) { |
|
3813 | 3813 | if ($item === null) { |
3814 | 3814 | return false; |
3815 | 3815 | } |
@@ -3889,7 +3889,7 @@ discard block |
||
3889 | 3889 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
3890 | 3890 | |
3891 | 3891 | $this->array = $this->reduce( |
3892 | - static function ($resultArray, $value) { |
|
3892 | + static function($resultArray, $value) { |
|
3893 | 3893 | if (!\in_array($value, $resultArray, true)) { |
3894 | 3894 | $resultArray[] = $value; |
3895 | 3895 | } |
@@ -3918,7 +3918,7 @@ discard block |
||
3918 | 3918 | |
3919 | 3919 | $this->array = \array_reduce( |
3920 | 3920 | \array_keys($array), |
3921 | - static function ($resultArray, $key) use ($array) { |
|
3921 | + static function($resultArray, $key) use ($array) { |
|
3922 | 3922 | if (!\in_array($array[$key], $resultArray, true)) { |
3923 | 3923 | $resultArray[$key] = $array[$key]; |
3924 | 3924 | } |
@@ -4219,7 +4219,7 @@ discard block |
||
4219 | 4219 | private function getPropertiesFromPhpDoc(): array |
4220 | 4220 | { |
4221 | 4221 | static $PROPERTY_CACHE = []; |
4222 | - $cacheKey = 'Class::' . static::class; |
|
4222 | + $cacheKey = 'Class::'.static::class; |
|
4223 | 4223 | |
4224 | 4224 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4225 | 4225 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -4387,7 +4387,7 @@ discard block |
||
4387 | 4387 | $this->properties !== [] |
4388 | 4388 | ) { |
4389 | 4389 | if (isset($this->properties[$key]) === false) { |
4390 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4390 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4391 | 4391 | } |
4392 | 4392 | |
4393 | 4393 | $this->properties[$key]->checkType($value); |