@@ -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 | }, |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | public static function createFromGeneratorImmutable(\Generator $generator): self |
| 1098 | 1098 | { |
| 1099 | 1099 | // init |
| 1100 | - $array = new static( $generator); |
|
| 1100 | + $array = new static($generator); |
|
| 1101 | 1101 | |
| 1102 | 1102 | return $array; |
| 1103 | 1103 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | // trim all string in the array |
| 1182 | 1182 | \array_walk( |
| 1183 | 1183 | $array, |
| 1184 | - static function (&$val) { |
|
| 1184 | + static function(&$val) { |
|
| 1185 | 1185 | if (\is_string($val)) { |
| 1186 | 1186 | $val = \trim($val); |
| 1187 | 1187 | } |
@@ -1497,40 +1497,40 @@ discard block |
||
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | $ops = [ |
| 1500 | - 'eq' => static function ($item, $prop, $value) { |
|
| 1500 | + 'eq' => static function($item, $prop, $value) { |
|
| 1501 | 1501 | return $item[$prop] === $value; |
| 1502 | 1502 | }, |
| 1503 | - 'gt' => static function ($item, $prop, $value) { |
|
| 1503 | + 'gt' => static function($item, $prop, $value) { |
|
| 1504 | 1504 | return $item[$prop] > $value; |
| 1505 | 1505 | }, |
| 1506 | - 'ge' => static function ($item, $prop, $value) { |
|
| 1506 | + 'ge' => static function($item, $prop, $value) { |
|
| 1507 | 1507 | return $item[$prop] >= $value; |
| 1508 | 1508 | }, |
| 1509 | - 'gte' => static function ($item, $prop, $value) { |
|
| 1509 | + 'gte' => static function($item, $prop, $value) { |
|
| 1510 | 1510 | return $item[$prop] >= $value; |
| 1511 | 1511 | }, |
| 1512 | - 'lt' => static function ($item, $prop, $value) { |
|
| 1512 | + 'lt' => static function($item, $prop, $value) { |
|
| 1513 | 1513 | return $item[$prop] < $value; |
| 1514 | 1514 | }, |
| 1515 | - 'le' => static function ($item, $prop, $value) { |
|
| 1515 | + 'le' => static function($item, $prop, $value) { |
|
| 1516 | 1516 | return $item[$prop] <= $value; |
| 1517 | 1517 | }, |
| 1518 | - 'lte' => static function ($item, $prop, $value) { |
|
| 1518 | + 'lte' => static function($item, $prop, $value) { |
|
| 1519 | 1519 | return $item[$prop] <= $value; |
| 1520 | 1520 | }, |
| 1521 | - 'ne' => static function ($item, $prop, $value) { |
|
| 1521 | + 'ne' => static function($item, $prop, $value) { |
|
| 1522 | 1522 | return $item[$prop] !== $value; |
| 1523 | 1523 | }, |
| 1524 | - 'contains' => static function ($item, $prop, $value) { |
|
| 1524 | + 'contains' => static function($item, $prop, $value) { |
|
| 1525 | 1525 | return \in_array($item[$prop], (array) $value, true); |
| 1526 | 1526 | }, |
| 1527 | - 'notContains' => static function ($item, $prop, $value) { |
|
| 1527 | + 'notContains' => static function($item, $prop, $value) { |
|
| 1528 | 1528 | return !\in_array($item[$prop], (array) $value, true); |
| 1529 | 1529 | }, |
| 1530 | - 'newer' => static function ($item, $prop, $value) { |
|
| 1530 | + 'newer' => static function($item, $prop, $value) { |
|
| 1531 | 1531 | return \strtotime($item[$prop]) > \strtotime($value); |
| 1532 | 1532 | }, |
| 1533 | - 'older' => static function ($item, $prop, $value) { |
|
| 1533 | + 'older' => static function($item, $prop, $value) { |
|
| 1534 | 1534 | return \strtotime($item[$prop]) < \strtotime($value); |
| 1535 | 1535 | }, |
| 1536 | 1536 | ]; |
@@ -1538,7 +1538,7 @@ discard block |
||
| 1538 | 1538 | $result = \array_values( |
| 1539 | 1539 | \array_filter( |
| 1540 | 1540 | $this->getArray(), |
| 1541 | - static function ($item) use ( |
|
| 1541 | + static function($item) use ( |
|
| 1542 | 1542 | $property, |
| 1543 | 1543 | $value, |
| 1544 | 1544 | $ops, |
@@ -2669,7 +2669,7 @@ discard block |
||
| 2669 | 2669 | } elseif (\is_array($item)) { |
| 2670 | 2670 | $result[$key] = self::create($item, $this->iteratorClass, false)->prependToEachKey($suffix)->toArray(); |
| 2671 | 2671 | } else { |
| 2672 | - $result[$key . $suffix] = $item; |
|
| 2672 | + $result[$key.$suffix] = $item; |
|
| 2673 | 2673 | } |
| 2674 | 2674 | } |
| 2675 | 2675 | |
@@ -2699,7 +2699,7 @@ discard block |
||
| 2699 | 2699 | } elseif (\is_object($item)) { |
| 2700 | 2700 | $result[$key] = $item; |
| 2701 | 2701 | } else { |
| 2702 | - $result[$key] = $item . $suffix; |
|
| 2702 | + $result[$key] = $item.$suffix; |
|
| 2703 | 2703 | } |
| 2704 | 2704 | } |
| 2705 | 2705 | |
@@ -2905,7 +2905,7 @@ discard block |
||
| 2905 | 2905 | if ($this->generator) { |
| 2906 | 2906 | $result = $init; |
| 2907 | 2907 | |
| 2908 | - foreach($this->getGenerator() as $value) { |
|
| 2908 | + foreach ($this->getGenerator() as $value) { |
|
| 2909 | 2909 | $result = $callable($result, $value); |
| 2910 | 2910 | } |
| 2911 | 2911 | |
@@ -3166,7 +3166,7 @@ discard block |
||
| 3166 | 3166 | public function replaceValues($search, $replacement = ''): self |
| 3167 | 3167 | { |
| 3168 | 3168 | $array = $this->each( |
| 3169 | - static function ($value) use ($search, $replacement) { |
|
| 3169 | + static function($value) use ($search, $replacement) { |
|
| 3170 | 3170 | return \str_replace($search, $replacement, $value); |
| 3171 | 3171 | } |
| 3172 | 3172 | ); |
@@ -3554,7 +3554,7 @@ discard block |
||
| 3554 | 3554 | |
| 3555 | 3555 | $that = $this; |
| 3556 | 3556 | $results = $arrayy->each( |
| 3557 | - static function ($value) use ($sorter, $that) { |
|
| 3557 | + static function($value) use ($sorter, $that) { |
|
| 3558 | 3558 | return \is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
| 3559 | 3559 | } |
| 3560 | 3560 | ); |
@@ -3604,7 +3604,7 @@ discard block |
||
| 3604 | 3604 | public function stripEmpty(): self |
| 3605 | 3605 | { |
| 3606 | 3606 | return $this->filter( |
| 3607 | - static function ($item) { |
|
| 3607 | + static function($item) { |
|
| 3608 | 3608 | if ($item === null) { |
| 3609 | 3609 | return false; |
| 3610 | 3610 | } |
@@ -3680,7 +3680,7 @@ discard block |
||
| 3680 | 3680 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
| 3681 | 3681 | |
| 3682 | 3682 | $this->array = $this->reduce( |
| 3683 | - static function ($resultArray, $value) { |
|
| 3683 | + static function($resultArray, $value) { |
|
| 3684 | 3684 | if (!\in_array($value, $resultArray, true)) { |
| 3685 | 3685 | $resultArray[] = $value; |
| 3686 | 3686 | } |
@@ -3709,7 +3709,7 @@ discard block |
||
| 3709 | 3709 | |
| 3710 | 3710 | $this->array = \array_reduce( |
| 3711 | 3711 | \array_keys($array), |
| 3712 | - static function ($resultArray, $key) use ($array) { |
|
| 3712 | + static function($resultArray, $key) use ($array) { |
|
| 3713 | 3713 | if (!\in_array($array[$key], $resultArray, true)) { |
| 3714 | 3714 | $resultArray[$key] = $array[$key]; |
| 3715 | 3715 | } |
@@ -3769,7 +3769,7 @@ discard block |
||
| 3769 | 3769 | public function values(): self |
| 3770 | 3770 | { |
| 3771 | 3771 | return static::create( |
| 3772 | - \array_values( $this->getArray()), |
|
| 3772 | + \array_values($this->getArray()), |
|
| 3773 | 3773 | $this->iteratorClass, |
| 3774 | 3774 | false |
| 3775 | 3775 | ); |
@@ -4006,7 +4006,7 @@ discard block |
||
| 4006 | 4006 | private function getPropertiesFromPhpDoc(): array |
| 4007 | 4007 | { |
| 4008 | 4008 | static $PROPERTY_CACHE = []; |
| 4009 | - $cacheKey = 'Class::' . static::class; |
|
| 4009 | + $cacheKey = 'Class::'.static::class; |
|
| 4010 | 4010 | |
| 4011 | 4011 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
| 4012 | 4012 | return $PROPERTY_CACHE[$cacheKey]; |
@@ -4174,7 +4174,7 @@ discard block |
||
| 4174 | 4174 | $this->properties !== [] |
| 4175 | 4175 | ) { |
| 4176 | 4176 | if (isset($this->properties[$key]) === false) { |
| 4177 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
| 4177 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
| 4178 | 4178 | } |
| 4179 | 4179 | |
| 4180 | 4180 | $this->properties[$key]->checkType($value); |