Passed
Branch master (14c761)
by Maxim
03:10
created
src/WS/Utils/Collections/HashMap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     public function getIterator()
24 24
     {
25
-        return new ArrayIterator(array_map(static function (MapEntry $entry) {
25
+        return new ArrayIterator(array_map(static function(MapEntry $entry) {
26 26
             return $entry->getValue();
27 27
         }, $this->entries));
28 28
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Iterator/IteratorFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     public static function directSequence($length): Iterator
11 11
     {
12 12
         $current = 0;
13
-        return new CallbackIterator(static function () use (& $current, $length) {
13
+        return new CallbackIterator(static function() use (& $current, $length) {
14 14
             if ($current === $length) {
15 15
                 return (new IterateResult())->setAsRunOut();
16 16
             }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public static function reverseSequence($length): Iterator
23 23
     {
24 24
         $current = $length - 1;
25
-        return new CallbackIterator(static function () use (& $current, $length) {
25
+        return new CallbackIterator(static function() use (& $current, $length) {
26 26
             if ($current === -1) {
27 27
                 return (new IterateResult())->setAsRunOut();
28 28
             }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Comparators.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
      */
14 14
     public static function scalarComparator(): callable
15 15
     {
16
-        return static function ($a, $b) {
16
+        return static function($a, $b) {
17 17
             return $a <=> $b;
18 18
         };
19 19
     }
20 20
 
21 21
     public static function objectPropertyComparator(string $property): callable
22 22
     {
23
-        return static function ($a, $b) use ($property) {
23
+        return static function($a, $b) use ($property) {
24 24
             return ObjectFunctions::getPropertyValue($a, $property) <=> ObjectFunctions::getPropertyValue($b, $property);
25 25
         };
26 26
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Aggregators.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
     public static function strImplode(string $delimiter = ''): Closure
21 21
     {
22
-        return static function (Collection $collection) use ($delimiter) {
22
+        return static function(Collection $collection) use ($delimiter) {
23 23
             return implode($delimiter, $collection->toArray());
24 24
         };
25 25
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
          * @param Collection $collection
35 35
          * @return float|int
36 36
          */
37
-        return static function (Collection $collection) {
37
+        return static function(Collection $collection) {
38 38
             $array = $collection->toArray();
39 39
 
40 40
             return array_sum($array) / count($array);
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public static function group(): Closure
49 49
     {
50
-        return static function (Collection $collection): Map {
51
-            $groupBy = self::groupBy(static function ($el) {
50
+        return static function(Collection $collection): Map {
51
+            $groupBy = self::groupBy(static function($el) {
52 52
                 return $el;
53 53
             });
54 54
             return $groupBy($collection);
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public static function groupByProperty(string $property): Closure
64 64
     {
65
-        return static function (Collection $collection) use ($property): Map {
66
-            $fGetValue = static function ($obj) use ($property) {
65
+        return static function(Collection $collection) use ($property): Map {
66
+            $fGetValue = static function($obj) use ($property) {
67 67
                 return ObjectFunctions::getPropertyValue($obj, $property);
68 68
             };
69 69
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 
75 75
     public static function groupBy(callable $f): Closure
76 76
     {
77
-        return static function (Collection $collection) use ($f): Map {
77
+        return static function(Collection $collection) use ($f): Map {
78 78
             $group = new HashMap();
79 79
             $collection
80 80
                 ->stream()
81
-                ->each(static function ($el) use ($group, $f) {
81
+                ->each(static function($el) use ($group, $f) {
82 82
                     $value = $f($el);
83 83
                     $count = 0;
84 84
                     if (($gCount = $group->get($value)) !== null) {
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Predicates.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,105 +12,105 @@
 block discarded – undo
12 12
 
13 13
     public static function lock(): Closure
14 14
     {
15
-        return static function (): bool {
15
+        return static function(): bool {
16 16
             return false;
17 17
         };
18 18
     }
19 19
 
20 20
     public static function notNull(): Closure
21 21
     {
22
-        return static function ($el): bool {
22
+        return static function($el): bool {
23 23
             return $el !== null;
24 24
         };
25 25
     }
26 26
 
27 27
     public static function notResistance(): Closure
28 28
     {
29
-        return static function (): bool {
29
+        return static function(): bool {
30 30
             return true;
31 31
         };
32 32
     }
33 33
 
34 34
     public static function equal($value): Closure
35 35
     {
36
-        return static function ($el) use ($value): bool {
36
+        return static function($el) use ($value): bool {
37 37
             return $el === $value;
38 38
         };
39 39
     }
40 40
 
41 41
     public static function lessThan($value): Closure
42 42
     {
43
-        return static function ($el) use ($value): bool {
43
+        return static function($el) use ($value): bool {
44 44
             return $el < $value;
45 45
         };
46 46
     }
47 47
 
48 48
     public static function lessOrEqual($value): Closure
49 49
     {
50
-        return static function ($el) use ($value): bool {
50
+        return static function($el) use ($value): bool {
51 51
             return $el <= $value;
52 52
         };
53 53
     }
54 54
 
55 55
     public static function moreThan($value): Closure
56 56
     {
57
-        return static function ($el) use ($value): bool {
57
+        return static function($el) use ($value): bool {
58 58
             return $el > $value;
59 59
         };
60 60
     }
61 61
 
62 62
     public static function moreOrEqual($value): Closure
63 63
     {
64
-        return static function ($el) use ($value): bool {
64
+        return static function($el) use ($value): bool {
65 65
             return $el >= $value;
66 66
         };
67 67
     }
68 68
 
69 69
     public static function not($value): Closure
70 70
     {
71
-        return static function ($el) use ($value): bool {
71
+        return static function($el) use ($value): bool {
72 72
             return $el !== $value;
73 73
         };
74 74
     }
75 75
 
76 76
     public static function in(array $values): Closure
77 77
     {
78
-        return static function ($el) use ($values): bool {
78
+        return static function($el) use ($values): bool {
79 79
             return in_array($el, $values, true);
80 80
         };
81 81
     }
82 82
 
83 83
     public static function notIn(array $values): Closure
84 84
     {
85
-        return static function ($el) use ($values): bool {
85
+        return static function($el) use ($values): bool {
86 86
             return !in_array($el, $values, true);
87 87
         };
88 88
     }
89 89
 
90 90
     public static function where(string $property, $value): Closure
91 91
     {
92
-        return static function ($ob) use ($property, $value) {
92
+        return static function($ob) use ($property, $value) {
93 93
             return $value === ObjectFunctions::getPropertyValue($ob, $property);
94 94
         };
95 95
     }
96 96
 
97 97
     public static function whereNot(string $property, $value): Closure
98 98
     {
99
-        return static function ($ob) use ($property, $value) {
99
+        return static function($ob) use ($property, $value) {
100 100
             return $value !== ObjectFunctions::getPropertyValue($ob, $property);
101 101
         };
102 102
     }
103 103
 
104 104
     public static function whereIn(string $property, array $values): Closure
105 105
     {
106
-        return static function ($ob) use ($property, $values) {
106
+        return static function($ob) use ($property, $values) {
107 107
             return in_array(ObjectFunctions::getPropertyValue($ob, $property), $values, true);
108 108
         };
109 109
     }
110 110
 
111 111
     public static function whereNotIn(string $property, array $values): Closure
112 112
     {
113
-        return static function ($ob) use ($property, $values) {
113
+        return static function($ob) use ($property, $values) {
114 114
             return !in_array(ObjectFunctions::getPropertyValue($ob, $property), $values, true);
115 115
         };
116 116
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Converters.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public static function toPropertyValue(string $name): Closure
19 19
     {
20
-        return static function ($obj) use ($name) {
20
+        return static function($obj) use ($name) {
21 21
             return ObjectFunctions::getPropertyValue($obj, $name);
22 22
         };
23 23
     }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function toProperties(array $names): Closure
31 31
     {
32
-        return static function ($obj) use ($names) {
32
+        return static function($obj) use ($names) {
33 33
             $res = [];
34 34
             foreach ($names as $name) {
35 35
                 $res[$name] = ObjectFunctions::getPropertyValue($obj, $name);
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Consumers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 {
10 10
     public static function dump(): callable
11 11
     {
12
-        return static function ($el) {
12
+        return static function($el) {
13 13
             var_dump($el);
14 14
         };
15 15
     }
Please login to merge, or discard this patch.
src/WS/Utils/Collections/Functions/Reorganizers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public static function shuffle(): Closure
19 19
     {
20
-        return static function (Collection $collection): Collection {
20
+        return static function(Collection $collection): Collection {
21 21
             $array = $collection->toArray();
22 22
             shuffle($array);
23 23
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function random(int $count = 1): Closure
34 34
     {
35
-        return static function (Collection $collection) use ($count): Collection {
35
+        return static function(Collection $collection) use ($count): Collection {
36 36
             /**
37 37
              * Collection
38 38
              */
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
             $generated = 0;
53 53
             $multiplicity = (int)round($collectionSize / $expectedCount);
54 54
 
55
-            $rangeRandomizer = static function () use ($multiplicity): int {
55
+            $rangeRandomizer = static function() use ($multiplicity): int {
56 56
                 return random_int(0, $multiplicity - 1);
57 57
             };
58 58
 
59
-            $trier = static function () use (& $generated, & $rest, $expectedCount, $rangeRandomizer): bool {
59
+            $trier = static function() use (& $generated, & $rest, $expectedCount, $rangeRandomizer): bool {
60 60
                 $rest--;
61 61
                 if ($generated === $expectedCount) {
62 62
                     return false;
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public static function chunk(int $size): Closure
87 87
     {
88
-        return static function (Collection $collection) use ($size): Collection {
88
+        return static function(Collection $collection) use ($size): Collection {
89 89
             $chunkCollection = self::collectionConstructor();
90 90
             $currentChunk = self::collectionConstructor();
91 91
             $pointer = $size;
92 92
             $collection
93 93
                 ->stream()
94
-                ->each(static function ($el) use ($size, $chunkCollection, & $currentChunk, & $pointer) {
94
+                ->each(static function($el) use ($size, $chunkCollection, & $currentChunk, & $pointer) {
95 95
                     $pointer--;
96 96
                     $currentChunk->add($el);
97 97
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public static function collapse(): Closure
114 114
     {
115
-        return static function (Collection $collection): Collection {
116
-            $flatIterable = static function (iterable $collection) use (& $flatIterable): array  {
115
+        return static function(Collection $collection): Collection {
116
+            $flatIterable = static function(iterable $collection) use (& $flatIterable): array  {
117 117
                 $res = [];
118 118
                 foreach ($collection as $item) {
119 119
                     if (is_iterable($item)) {
Please login to merge, or discard this patch.
src/WS/Utils/Collections/ImmutableList.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
     public function removeAt(int $index)
61 61
     {
62
-       throw $this->createBlockingException();
62
+        throw $this->createBlockingException();
63 63
     }
64 64
 
65 65
     private function createBlockingException(): RuntimeException
Please login to merge, or discard this patch.