Completed
Push — master ( 9acfcd...65928f )
by Lars
02:05
created
src/Arrayy.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         );
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
             return $this->in_array_recursive(
949 949
                 \mb_strtoupper((string) $value),
950 950
                 $this->walk(
951
-                    static function (&$val) {
951
+                    static function(&$val) {
952 952
                         /** @noinspection PhpComposerExtensionStubsInspection */
953 953
                         $val = \mb_strtoupper((string) $val);
954 954
                     },
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
         return \in_array(
963 963
             \mb_strtoupper((string) $value),
964 964
             $this->walk(
965
-                static function (&$val) {
965
+                static function(&$val) {
966 966
                     /** @noinspection PhpComposerExtensionStubsInspection */
967 967
                     $val = \mb_strtoupper((string) $val);
968 968
                 },
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
         // trim all string in the array
1254 1254
         \array_walk(
1255 1255
             $array,
1256
-            static function (&$val) {
1256
+            static function(&$val) {
1257 1257
                 if (\is_string($val)) {
1258 1258
                     $val = \trim($val);
1259 1259
                 }
@@ -1581,40 +1581,40 @@  discard block
 block discarded – undo
1581 1581
         }
1582 1582
 
1583 1583
         $ops = [
1584
-            'eq' => static function ($item, $prop, $value) {
1584
+            'eq' => static function($item, $prop, $value) {
1585 1585
                 return $item[$prop] === $value;
1586 1586
             },
1587
-            'gt' => static function ($item, $prop, $value) {
1587
+            'gt' => static function($item, $prop, $value) {
1588 1588
                 return $item[$prop] > $value;
1589 1589
             },
1590
-            'ge' => static function ($item, $prop, $value) {
1590
+            'ge' => static function($item, $prop, $value) {
1591 1591
                 return $item[$prop] >= $value;
1592 1592
             },
1593
-            'gte' => static function ($item, $prop, $value) {
1593
+            'gte' => static function($item, $prop, $value) {
1594 1594
                 return $item[$prop] >= $value;
1595 1595
             },
1596
-            'lt' => static function ($item, $prop, $value) {
1596
+            'lt' => static function($item, $prop, $value) {
1597 1597
                 return $item[$prop] < $value;
1598 1598
             },
1599
-            'le' => static function ($item, $prop, $value) {
1599
+            'le' => static function($item, $prop, $value) {
1600 1600
                 return $item[$prop] <= $value;
1601 1601
             },
1602
-            'lte' => static function ($item, $prop, $value) {
1602
+            'lte' => static function($item, $prop, $value) {
1603 1603
                 return $item[$prop] <= $value;
1604 1604
             },
1605
-            'ne' => static function ($item, $prop, $value) {
1605
+            'ne' => static function($item, $prop, $value) {
1606 1606
                 return $item[$prop] !== $value;
1607 1607
             },
1608
-            'contains' => static function ($item, $prop, $value) {
1608
+            'contains' => static function($item, $prop, $value) {
1609 1609
                 return \in_array($item[$prop], (array) $value, true);
1610 1610
             },
1611
-            'notContains' => static function ($item, $prop, $value) {
1611
+            'notContains' => static function($item, $prop, $value) {
1612 1612
                 return !\in_array($item[$prop], (array) $value, true);
1613 1613
             },
1614
-            'newer' => static function ($item, $prop, $value) {
1614
+            'newer' => static function($item, $prop, $value) {
1615 1615
                 return \strtotime($item[$prop]) > \strtotime($value);
1616 1616
             },
1617
-            'older' => static function ($item, $prop, $value) {
1617
+            'older' => static function($item, $prop, $value) {
1618 1618
                 return \strtotime($item[$prop]) < \strtotime($value);
1619 1619
             },
1620 1620
         ];
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
         $result = \array_values(
1623 1623
             \array_filter(
1624 1624
                 $this->getArray(),
1625
-                static function ($item) use (
1625
+                static function($item) use (
1626 1626
                     $property,
1627 1627
                     $value,
1628 1628
                     $ops,
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
                 \array_uintersect(
2171 2171
                     $this->array,
2172 2172
                     $search,
2173
-                    static function ($a, $b) {
2173
+                    static function($a, $b) {
2174 2174
                         return $a === $b ? 0 : -1;
2175 2175
                     }
2176 2176
                 ),
@@ -2387,13 +2387,13 @@  discard block
 block discarded – undo
2387 2387
         // non recursive
2388 2388
 
2389 2389
         if ($search_value === null) {
2390
-            $arrayFunction = function () {
2390
+            $arrayFunction = function() {
2391 2391
                 foreach ($this->array as $key => $value) {
2392 2392
                     yield $key;
2393 2393
                 }
2394 2394
             };
2395 2395
         } else {
2396
-            $arrayFunction = function () use ($search_value, $strict) {
2396
+            $arrayFunction = function() use ($search_value, $strict) {
2397 2397
                 foreach ($this->array as $key => $value) {
2398 2398
                     if ($strict) {
2399 2399
                         if ($search_value === $value) {
@@ -2892,7 +2892,7 @@  discard block
 block discarded – undo
2892 2892
                 )->prependToEachKey($suffix)
2893 2893
                     ->toArray();
2894 2894
             } else {
2895
-                $result[$key . $suffix] = $item;
2895
+                $result[$key.$suffix] = $item;
2896 2896
             }
2897 2897
         }
2898 2898
 
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
             } elseif (\is_object($item)) {
2930 2930
                 $result[$key] = $item;
2931 2931
             } else {
2932
-                $result[$key] = $item . $suffix;
2932
+                $result[$key] = $item.$suffix;
2933 2933
             }
2934 2934
         }
2935 2935
 
@@ -3461,7 +3461,7 @@  discard block
 block discarded – undo
3461 3461
     public function replaceValues($search, $replacement = ''): self
3462 3462
     {
3463 3463
         $array = $this->each(
3464
-            static function ($value) use ($search, $replacement) {
3464
+            static function($value) use ($search, $replacement) {
3465 3465
                 return \str_replace($search, $replacement, $value);
3466 3466
             }
3467 3467
         );
@@ -3960,7 +3960,7 @@  discard block
 block discarded – undo
3960 3960
             );
3961 3961
 
3962 3962
             $results = $arrayy->each(
3963
-                function ($value) use ($sorter) {
3963
+                function($value) use ($sorter) {
3964 3964
                     if (\is_callable($sorter)) {
3965 3965
                         return $sorter($value);
3966 3966
                     }
@@ -4022,7 +4022,7 @@  discard block
 block discarded – undo
4022 4022
     public function stripEmpty(): self
4023 4023
     {
4024 4024
         return $this->filter(
4025
-            static function ($item) {
4025
+            static function($item) {
4026 4026
                 if ($item === null) {
4027 4027
                     return false;
4028 4028
                 }
@@ -4107,7 +4107,7 @@  discard block
 block discarded – undo
4107 4107
         // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array
4108 4108
 
4109 4109
         $this->array = $this->reduce(
4110
-            static function ($resultArray, $value) {
4110
+            static function($resultArray, $value) {
4111 4111
                 if (!\in_array($value, $resultArray, true)) {
4112 4112
                     $resultArray[] = $value;
4113 4113
                 }
@@ -4136,7 +4136,7 @@  discard block
 block discarded – undo
4136 4136
 
4137 4137
         $this->array = \array_reduce(
4138 4138
             \array_keys($array),
4139
-            static function ($resultArray, $key) use ($array) {
4139
+            static function($resultArray, $key) use ($array) {
4140 4140
                 if (!\in_array($array[$key], $resultArray, true)) {
4141 4141
                     $resultArray[$key] = $array[$key];
4142 4142
                 }
@@ -4221,7 +4221,7 @@  discard block
 block discarded – undo
4221 4221
     public function values(): self
4222 4222
     {
4223 4223
         return static::create(
4224
-            function () {
4224
+            function() {
4225 4225
                 /** @noinspection YieldFromCanBeUsedInspection */
4226 4226
                 foreach ($this->getGenerator() as $value) {
4227 4227
                     yield $value;
@@ -4622,7 +4622,7 @@  discard block
 block discarded – undo
4622 4622
             $this->properties !== []
4623 4623
         ) {
4624 4624
             if (isset($this->properties[$key]) === false) {
4625
-                throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').');
4625
+                throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').');
4626 4626
             }
4627 4627
 
4628 4628
             $this->properties[$key]->checkType($value);
@@ -4774,7 +4774,7 @@  discard block
 block discarded – undo
4774 4774
     private function getPropertiesFromPhpDoc(): array
4775 4775
     {
4776 4776
         static $PROPERTY_CACHE = [];
4777
-        $cacheKey = 'Class::' . static::class;
4777
+        $cacheKey = 'Class::'.static::class;
4778 4778
 
4779 4779
         if (isset($PROPERTY_CACHE[$cacheKey])) {
4780 4780
             return $PROPERTY_CACHE[$cacheKey];
Please login to merge, or discard this patch.