Completed
Push — master ( 9da4f3...caa7ee )
by Lars
02:50 queued 11s
created
src/Arrayy.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             &&
102 102
             \count(\array_diff_key($this->properties, $data)) > 0
103 103
         ) {
104
-            throw new \InvalidArgumentException('Property mismatch - input: ' . \print_r(\array_keys($data), true) . ' | expected: ' . \print_r(\array_keys($this->properties), true));
104
+            throw new \InvalidArgumentException('Property mismatch - input: '.\print_r(\array_keys($data), true).' | expected: '.\print_r(\array_keys($this->properties), true));
105 105
         }
106 106
 
107 107
         /** @noinspection AlterInForeachInspection */
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
                     $this->callAtPath(
465 465
                         $containerPath,
466
-                        static function ($container) use ($lastOffset, &$offsetExists) {
466
+                        static function($container) use ($lastOffset, &$offsetExists) {
467 467
                             $offsetExists = \array_key_exists($lastOffset, $container);
468 468
                         }
469 469
                     );
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
                 $this->callAtPath(
539 539
                     \implode($this->pathSeparator, $path),
540
-                    static function (&$offset) use ($pathToUnset) {
540
+                    static function(&$offset) use ($pathToUnset) {
541 541
                         unset($offset[$pathToUnset]);
542 542
                     }
543 543
                 );
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
         }
576 576
 
577 577
         if (\strpos($class, '\\') === 0) {
578
-            $class = '\\' . $class;
578
+            $class = '\\'.$class;
579 579
             if (\class_exists($class)) {
580 580
                 $this->iteratorClass = $class;
581 581
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             }
584 584
         }
585 585
 
586
-        throw new \InvalidArgumentException('The iterator class does not exist: ' . $class);
586
+        throw new \InvalidArgumentException('The iterator class does not exist: '.$class);
587 587
     }
588 588
 
589 589
     /**
@@ -691,13 +691,13 @@  discard block
 block discarded – undo
691 691
 
692 692
         foreach ($this->getGenerator() as $key => $item) {
693 693
             if ($item instanceof self) {
694
-                $result[$prefix . $key] = $item->appendToEachKey($prefix);
694
+                $result[$prefix.$key] = $item->appendToEachKey($prefix);
695 695
             } elseif (\is_array($item)) {
696
-                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
696
+                $result[$prefix.$key] = self::create($item, $this->iteratorClass, false)
697 697
                     ->appendToEachKey($prefix)
698 698
                     ->toArray();
699 699
             } else {
700
-                $result[$prefix . $key] = $item;
700
+                $result[$prefix.$key] = $item;
701 701
             }
702 702
         }
703 703
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
             } elseif (\is_object($item)) {
726 726
                 $result[$key] = $item;
727 727
             } else {
728
-                $result[$key] = $prefix . $item;
728
+                $result[$key] = $prefix.$item;
729 729
             }
730 730
         }
731 731
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
     public function clean(): self
875 875
     {
876 876
         return $this->filter(
877
-            static function ($value) {
877
+            static function($value) {
878 878
                 return (bool) $value;
879 879
             }
880 880
         );
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
         // trim all string in the array
1229 1229
         \array_walk(
1230 1230
             $array,
1231
-            static function (&$val) {
1231
+            static function(&$val) {
1232 1232
                 if (\is_string($val)) {
1233 1233
                     $val = \trim($val);
1234 1234
                 }
@@ -1617,40 +1617,40 @@  discard block
 block discarded – undo
1617 1617
         }
1618 1618
 
1619 1619
         $ops = [
1620
-            'eq' => static function ($item, $prop, $value) {
1620
+            'eq' => static function($item, $prop, $value) {
1621 1621
                 return $item[$prop] === $value;
1622 1622
             },
1623
-            'gt' => static function ($item, $prop, $value) {
1623
+            'gt' => static function($item, $prop, $value) {
1624 1624
                 return $item[$prop] > $value;
1625 1625
             },
1626
-            'ge' => static function ($item, $prop, $value) {
1626
+            'ge' => static function($item, $prop, $value) {
1627 1627
                 return $item[$prop] >= $value;
1628 1628
             },
1629
-            'gte' => static function ($item, $prop, $value) {
1629
+            'gte' => static function($item, $prop, $value) {
1630 1630
                 return $item[$prop] >= $value;
1631 1631
             },
1632
-            'lt' => static function ($item, $prop, $value) {
1632
+            'lt' => static function($item, $prop, $value) {
1633 1633
                 return $item[$prop] < $value;
1634 1634
             },
1635
-            'le' => static function ($item, $prop, $value) {
1635
+            'le' => static function($item, $prop, $value) {
1636 1636
                 return $item[$prop] <= $value;
1637 1637
             },
1638
-            'lte' => static function ($item, $prop, $value) {
1638
+            'lte' => static function($item, $prop, $value) {
1639 1639
                 return $item[$prop] <= $value;
1640 1640
             },
1641
-            'ne' => static function ($item, $prop, $value) {
1641
+            'ne' => static function($item, $prop, $value) {
1642 1642
                 return $item[$prop] !== $value;
1643 1643
             },
1644
-            'contains' => static function ($item, $prop, $value) {
1644
+            'contains' => static function($item, $prop, $value) {
1645 1645
                 return \in_array($item[$prop], (array) $value, true);
1646 1646
             },
1647
-            'notContains' => static function ($item, $prop, $value) {
1647
+            'notContains' => static function($item, $prop, $value) {
1648 1648
                 return !\in_array($item[$prop], (array) $value, true);
1649 1649
             },
1650
-            'newer' => static function ($item, $prop, $value) {
1650
+            'newer' => static function($item, $prop, $value) {
1651 1651
                 return \strtotime($item[$prop]) > \strtotime($value);
1652 1652
             },
1653
-            'older' => static function ($item, $prop, $value) {
1653
+            'older' => static function($item, $prop, $value) {
1654 1654
                 return \strtotime($item[$prop]) < \strtotime($value);
1655 1655
             },
1656 1656
         ];
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
         $result = \array_values(
1659 1659
             \array_filter(
1660 1660
                 $this->getArray(),
1661
-                static function ($item) use (
1661
+                static function($item) use (
1662 1662
                     $property,
1663 1663
                     $value,
1664 1664
                     $ops,
@@ -2341,7 +2341,7 @@  discard block
 block discarded – undo
2341 2341
                 \array_uintersect(
2342 2342
                     $this->array,
2343 2343
                     $search,
2344
-                    static function ($a, $b) {
2344
+                    static function($a, $b) {
2345 2345
                         return $a === $b ? 0 : -1;
2346 2346
                     }
2347 2347
                 ),
@@ -2589,13 +2589,13 @@  discard block
 block discarded – undo
2589 2589
         // non recursive
2590 2590
 
2591 2591
         if ($search_values === null) {
2592
-            $arrayFunction = function () {
2592
+            $arrayFunction = function() {
2593 2593
                 foreach ($this->getGenerator() as $key => $value) {
2594 2594
                     yield $key;
2595 2595
                 }
2596 2596
             };
2597 2597
         } else {
2598
-            $arrayFunction = function () use ($search_values, $strict) {
2598
+            $arrayFunction = function() use ($search_values, $strict) {
2599 2599
                 $is_array_tmp = \is_array($search_values);
2600 2600
 
2601 2601
                 foreach ($this->getGenerator() as $key => $value) {
@@ -2795,7 +2795,7 @@  discard block
 block discarded – undo
2795 2795
         $useArguments = \func_num_args() > 2;
2796 2796
 
2797 2797
         return static::create(
2798
-            function () use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
2798
+            function() use ($useArguments, $callable, $useKeyAsSecondParameter, $arguments) {
2799 2799
                 foreach ($this->getGenerator() as $key => $value) {
2800 2800
                     if ($useArguments) {
2801 2801
                         if ($useKeyAsSecondParameter) {
@@ -3149,7 +3149,7 @@  discard block
 block discarded – undo
3149 3149
                 )->prependToEachKey($suffix)
3150 3150
                     ->toArray();
3151 3151
             } else {
3152
-                $result[$key . $suffix] = $item;
3152
+                $result[$key.$suffix] = $item;
3153 3153
             }
3154 3154
         }
3155 3155
 
@@ -3186,7 +3186,7 @@  discard block
 block discarded – undo
3186 3186
             } elseif (\is_object($item)) {
3187 3187
                 $result[$key] = $item;
3188 3188
             } else {
3189
-                $result[$key] = $item . $suffix;
3189
+                $result[$key] = $item.$suffix;
3190 3190
             }
3191 3191
         }
3192 3192
 
@@ -3775,7 +3775,7 @@  discard block
 block discarded – undo
3775 3775
     public function replaceValues($search, $replacement = ''): self
3776 3776
     {
3777 3777
         return $this->each(
3778
-            static function ($value) use ($search, $replacement) {
3778
+            static function($value) use ($search, $replacement) {
3779 3779
                 return \str_replace($search, $replacement, $value);
3780 3780
             }
3781 3781
         );
@@ -4273,7 +4273,7 @@  discard block
 block discarded – undo
4273 4273
             );
4274 4274
 
4275 4275
             $results = $arrayy->each(
4276
-                function ($value) use ($sorter) {
4276
+                function($value) use ($sorter) {
4277 4277
                     if (\is_callable($sorter)) {
4278 4278
                         return $sorter($value);
4279 4279
                     }
@@ -4335,7 +4335,7 @@  discard block
 block discarded – undo
4335 4335
     public function stripEmpty(): self
4336 4336
     {
4337 4337
         return $this->filter(
4338
-            static function ($item) {
4338
+            static function($item) {
4339 4339
                 if ($item === null) {
4340 4340
                     return false;
4341 4341
                 }
@@ -4419,7 +4419,7 @@  discard block
 block discarded – undo
4419 4419
         // INFO: \array_unique() can't handle e.g. "stdClass"-values in an array
4420 4420
 
4421 4421
         $this->array = $this->reduce(
4422
-            static function ($resultArray, $value) {
4422
+            static function($resultArray, $value) {
4423 4423
                 if (!\in_array($value, $resultArray, true)) {
4424 4424
                     $resultArray[] = $value;
4425 4425
                 }
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
 
4449 4449
         $this->array = \array_reduce(
4450 4450
             \array_keys($array),
4451
-            static function ($resultArray, $key) use ($array) {
4451
+            static function($resultArray, $key) use ($array) {
4452 4452
                 if (!\in_array($array[$key], $resultArray, true)) {
4453 4453
                     $resultArray[$key] = $array[$key];
4454 4454
                 }
@@ -4508,7 +4508,7 @@  discard block
 block discarded – undo
4508 4508
     public function values(): self
4509 4509
     {
4510 4510
         return static::create(
4511
-            function () {
4511
+            function() {
4512 4512
                 /** @noinspection YieldFromCanBeUsedInspection */
4513 4513
                 foreach ($this->getGenerator() as $value) {
4514 4514
                     yield $value;
@@ -4941,7 +4941,7 @@  discard block
 block discarded – undo
4941 4941
             $this->properties !== []
4942 4942
         ) {
4943 4943
             if (isset($this->properties[$key]) === false) {
4944
-                throw new \InvalidArgumentException('The key ' . $key . ' does not exists as @property in the class (' . \get_class($this) . ').');
4944
+                throw new \InvalidArgumentException('The key '.$key.' does not exists as @property in the class ('.\get_class($this).').');
4945 4945
             }
4946 4946
 
4947 4947
             $this->properties[$key]->checkType($value);
@@ -5093,7 +5093,7 @@  discard block
 block discarded – undo
5093 5093
     private function getPropertiesFromPhpDoc(): array
5094 5094
     {
5095 5095
         static $PROPERTY_CACHE = [];
5096
-        $cacheKey = 'Class::' . static::class;
5096
+        $cacheKey = 'Class::'.static::class;
5097 5097
 
5098 5098
         if (isset($PROPERTY_CACHE[$cacheKey])) {
5099 5099
             return $PROPERTY_CACHE[$cacheKey];
Please login to merge, or discard this patch.