@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | && |
106 | 106 | \count(\array_diff_key($this->properties, $data)) > 0 |
107 | 107 | ) { |
108 | - throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true)); |
|
108 | + throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true)); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** @noinspection AlterInForeachInspection */ |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | $this->callAtPath( |
469 | 469 | $containerPath, |
470 | - static function ($container) use ($lastOffset, &$offsetExists) { |
|
470 | + static function($container) use ($lastOffset, &$offsetExists) { |
|
471 | 471 | $offsetExists = \array_key_exists($lastOffset, $container); |
472 | 472 | } |
473 | 473 | ); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | $this->callAtPath( |
543 | 543 | \implode($this->pathSeparator, $path), |
544 | - static function (&$offset) use ($pathToUnset) { |
|
544 | + static function(&$offset) use ($pathToUnset) { |
|
545 | 545 | unset($offset[$pathToUnset]); |
546 | 546 | } |
547 | 547 | ); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | if (\strpos($class, '\\') === 0) { |
584 | - $class = '\\' . $class; |
|
584 | + $class = '\\'.$class; |
|
585 | 585 | if (\class_exists($class)) { |
586 | 586 | $this->iteratorClass = $class; |
587 | 587 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
592 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
592 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
@@ -697,13 +697,13 @@ discard block |
||
697 | 697 | |
698 | 698 | foreach ($this->getGenerator() as $key => $item) { |
699 | 699 | if ($item instanceof self) { |
700 | - $result[$prefix . $key] = $item->appendToEachKey($prefix); |
|
700 | + $result[$prefix.$key] = $item->appendToEachKey($prefix); |
|
701 | 701 | } elseif (\is_array($item)) { |
702 | - $result[$prefix . $key] = self::create($item, $this->iteratorClass, false) |
|
702 | + $result[$prefix.$key] = self::create($item, $this->iteratorClass, false) |
|
703 | 703 | ->appendToEachKey($prefix) |
704 | 704 | ->toArray(); |
705 | 705 | } else { |
706 | - $result[$prefix . $key] = $item; |
|
706 | + $result[$prefix.$key] = $item; |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | } elseif (\is_object($item)) { |
732 | 732 | $result[$key] = $item; |
733 | 733 | } else { |
734 | - $result[$key] = $prefix . $item; |
|
734 | + $result[$key] = $prefix.$item; |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | public function clean(): self |
883 | 883 | { |
884 | 884 | return $this->filter( |
885 | - static function ($value) { |
|
885 | + static function($value) { |
|
886 | 886 | return (bool) $value; |
887 | 887 | } |
888 | 888 | ); |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | // trim all string in the array |
1249 | 1249 | \array_walk( |
1250 | 1250 | $array, |
1251 | - static function (&$val) { |
|
1251 | + static function(&$val) { |
|
1252 | 1252 | if (\is_string($val)) { |
1253 | 1253 | $val = \trim($val); |
1254 | 1254 | } |
@@ -1576,40 +1576,40 @@ discard block |
||
1576 | 1576 | } |
1577 | 1577 | |
1578 | 1578 | $ops = [ |
1579 | - 'eq' => static function ($item, $prop, $value) { |
|
1579 | + 'eq' => static function($item, $prop, $value) { |
|
1580 | 1580 | return $item[$prop] === $value; |
1581 | 1581 | }, |
1582 | - 'gt' => static function ($item, $prop, $value) { |
|
1582 | + 'gt' => static function($item, $prop, $value) { |
|
1583 | 1583 | return $item[$prop] > $value; |
1584 | 1584 | }, |
1585 | - 'ge' => static function ($item, $prop, $value) { |
|
1585 | + 'ge' => static function($item, $prop, $value) { |
|
1586 | 1586 | return $item[$prop] >= $value; |
1587 | 1587 | }, |
1588 | - 'gte' => static function ($item, $prop, $value) { |
|
1588 | + 'gte' => static function($item, $prop, $value) { |
|
1589 | 1589 | return $item[$prop] >= $value; |
1590 | 1590 | }, |
1591 | - 'lt' => static function ($item, $prop, $value) { |
|
1591 | + 'lt' => static function($item, $prop, $value) { |
|
1592 | 1592 | return $item[$prop] < $value; |
1593 | 1593 | }, |
1594 | - 'le' => static function ($item, $prop, $value) { |
|
1594 | + 'le' => static function($item, $prop, $value) { |
|
1595 | 1595 | return $item[$prop] <= $value; |
1596 | 1596 | }, |
1597 | - 'lte' => static function ($item, $prop, $value) { |
|
1597 | + 'lte' => static function($item, $prop, $value) { |
|
1598 | 1598 | return $item[$prop] <= $value; |
1599 | 1599 | }, |
1600 | - 'ne' => static function ($item, $prop, $value) { |
|
1600 | + 'ne' => static function($item, $prop, $value) { |
|
1601 | 1601 | return $item[$prop] !== $value; |
1602 | 1602 | }, |
1603 | - 'contains' => static function ($item, $prop, $value) { |
|
1603 | + 'contains' => static function($item, $prop, $value) { |
|
1604 | 1604 | return \in_array($item[$prop], (array) $value, true); |
1605 | 1605 | }, |
1606 | - 'notContains' => static function ($item, $prop, $value) { |
|
1606 | + 'notContains' => static function($item, $prop, $value) { |
|
1607 | 1607 | return !\in_array($item[$prop], (array) $value, true); |
1608 | 1608 | }, |
1609 | - 'newer' => static function ($item, $prop, $value) { |
|
1609 | + 'newer' => static function($item, $prop, $value) { |
|
1610 | 1610 | return \strtotime($item[$prop]) > \strtotime($value); |
1611 | 1611 | }, |
1612 | - 'older' => static function ($item, $prop, $value) { |
|
1612 | + 'older' => static function($item, $prop, $value) { |
|
1613 | 1613 | return \strtotime($item[$prop]) < \strtotime($value); |
1614 | 1614 | }, |
1615 | 1615 | ]; |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | $result = \array_values( |
1618 | 1618 | \array_filter( |
1619 | 1619 | $this->getArray(), |
1620 | - static function ($item) use ( |
|
1620 | + static function($item) use ( |
|
1621 | 1621 | $property, |
1622 | 1622 | $value, |
1623 | 1623 | $ops, |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | \array_uintersect( |
2166 | 2166 | $this->array, |
2167 | 2167 | $search, |
2168 | - static function ($a, $b) { |
|
2168 | + static function($a, $b) { |
|
2169 | 2169 | return $a === $b ? 0 : -1; |
2170 | 2170 | } |
2171 | 2171 | ), |
@@ -2382,13 +2382,13 @@ discard block |
||
2382 | 2382 | // non recursive |
2383 | 2383 | |
2384 | 2384 | if ($search_value === null) { |
2385 | - $arrayFunction = function () { |
|
2385 | + $arrayFunction = function() { |
|
2386 | 2386 | foreach ($this->getGenerator() as $key => $value) { |
2387 | 2387 | yield $key; |
2388 | 2388 | } |
2389 | 2389 | }; |
2390 | 2390 | } else { |
2391 | - $arrayFunction = function () use ($search_value, $strict) { |
|
2391 | + $arrayFunction = function() use ($search_value, $strict) { |
|
2392 | 2392 | foreach ($this->getGenerator() as $key => $value) { |
2393 | 2393 | if ($strict) { |
2394 | 2394 | if ($search_value === $value) { |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | $useArguments = \func_num_args() > 2; |
2554 | 2554 | |
2555 | 2555 | return static::create( |
2556 | - function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2556 | + function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) { |
|
2557 | 2557 | foreach ($this->getGenerator() as $key => $value) { |
2558 | 2558 | if ($useArguments) { |
2559 | 2559 | if ($useKeyAsSecondParameter) { |
@@ -2908,7 +2908,7 @@ discard block |
||
2908 | 2908 | )->prependToEachKey($suffix) |
2909 | 2909 | ->toArray(); |
2910 | 2910 | } else { |
2911 | - $result[$key . $suffix] = $item; |
|
2911 | + $result[$key.$suffix] = $item; |
|
2912 | 2912 | } |
2913 | 2913 | } |
2914 | 2914 | |
@@ -2945,7 +2945,7 @@ discard block |
||
2945 | 2945 | } elseif (\is_object($item)) { |
2946 | 2946 | $result[$key] = $item; |
2947 | 2947 | } else { |
2948 | - $result[$key] = $item . $suffix; |
|
2948 | + $result[$key] = $item.$suffix; |
|
2949 | 2949 | } |
2950 | 2950 | } |
2951 | 2951 | |
@@ -3477,7 +3477,7 @@ discard block |
||
3477 | 3477 | public function replaceValues($search, $replacement = ''): self |
3478 | 3478 | { |
3479 | 3479 | $array = $this->each( |
3480 | - static function ($value) use ($search, $replacement) { |
|
3480 | + static function($value) use ($search, $replacement) { |
|
3481 | 3481 | return \str_replace($search, $replacement, $value); |
3482 | 3482 | } |
3483 | 3483 | ); |
@@ -3976,7 +3976,7 @@ discard block |
||
3976 | 3976 | ); |
3977 | 3977 | |
3978 | 3978 | $results = $arrayy->each( |
3979 | - function ($value) use ($sorter) { |
|
3979 | + function($value) use ($sorter) { |
|
3980 | 3980 | if (\is_callable($sorter)) { |
3981 | 3981 | return $sorter($value); |
3982 | 3982 | } |
@@ -4038,7 +4038,7 @@ discard block |
||
4038 | 4038 | public function stripEmpty(): self |
4039 | 4039 | { |
4040 | 4040 | return $this->filter( |
4041 | - static function ($item) { |
|
4041 | + static function($item) { |
|
4042 | 4042 | if ($item === null) { |
4043 | 4043 | return false; |
4044 | 4044 | } |
@@ -4123,7 +4123,7 @@ discard block |
||
4123 | 4123 | // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array |
4124 | 4124 | |
4125 | 4125 | $this->array = $this->reduce( |
4126 | - static function ($resultArray, $value) { |
|
4126 | + static function($resultArray, $value) { |
|
4127 | 4127 | if (!\in_array($value, $resultArray, true)) { |
4128 | 4128 | $resultArray[] = $value; |
4129 | 4129 | } |
@@ -4152,7 +4152,7 @@ discard block |
||
4152 | 4152 | |
4153 | 4153 | $this->array = \array_reduce( |
4154 | 4154 | \array_keys($array), |
4155 | - static function ($resultArray, $key) use ($array) { |
|
4155 | + static function($resultArray, $key) use ($array) { |
|
4156 | 4156 | if (!\in_array($array[$key], $resultArray, true)) { |
4157 | 4157 | $resultArray[$key] = $array[$key]; |
4158 | 4158 | } |
@@ -4237,7 +4237,7 @@ discard block |
||
4237 | 4237 | public function values(): self |
4238 | 4238 | { |
4239 | 4239 | return static::create( |
4240 | - function () { |
|
4240 | + function() { |
|
4241 | 4241 | /** @noinspection YieldFromCanBeUsedInspection */ |
4242 | 4242 | foreach ($this->getGenerator() as $value) { |
4243 | 4243 | yield $value; |
@@ -4643,7 +4643,7 @@ discard block |
||
4643 | 4643 | $this->properties !== [] |
4644 | 4644 | ) { |
4645 | 4645 | if (isset($this->properties[$key]) === false) { |
4646 | - throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').'); |
|
4646 | + throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').'); |
|
4647 | 4647 | } |
4648 | 4648 | |
4649 | 4649 | $this->properties[$key]->checkType($value); |
@@ -4795,7 +4795,7 @@ discard block |
||
4795 | 4795 | private function getPropertiesFromPhpDoc(): array |
4796 | 4796 | { |
4797 | 4797 | static $PROPERTY_CACHE = []; |
4798 | - $cacheKey = 'Class::' . static::class; |
|
4798 | + $cacheKey = 'Class::'.static::class; |
|
4799 | 4799 | |
4800 | 4800 | if (isset($PROPERTY_CACHE[$cacheKey])) { |
4801 | 4801 | return $PROPERTY_CACHE[$cacheKey]; |