Passed
Push — develop ( e09916...2ad49a )
by nguereza
01:41
created
src/Exception/InvalidOperationException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,6 +38,5 @@
 block discarded – undo
38 38
  * Class InvalidOperationException
39 39
  * @package Platine\Collection\Exception
40 40
  */
41
-class InvalidOperationException extends Exception
42
-{
41
+class InvalidOperationException extends Exception {
43 42
 }
Please login to merge, or discard this patch.
src/IterableInterface.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,5 +58,5 @@
 block discarded – undo
58 58
      * @param callable $callback
59 59
      * @return void
60 60
      */
61
-    public function forEach(callable $callback): void;
61
+    public function forEach (callable $callback): void;
62 62
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,5 +58,5 @@
 block discarded – undo
58 58
      * @param callable $callback
59 59
      * @return void
60 60
      */
61
-    public function forEach(callable $callback): void;
61
+    public function foreach(callable $callback): void;
62 62
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
  * Class IterableInterface
51 51
  * @package Platine\Collection
52 52
  */
53
-interface IterableInterface
54
-{
53
+interface IterableInterface {
55 54
     /**
56 55
      * Loop on each collection element with the given callback
57 56
      * @param callable $callback
Please login to merge, or discard this patch.
src/Generic/ArrayList.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $diffValues = array_udiff(
107 107
             $this->all(),
108 108
             $collection->all(),
109
-            function ($a, $b) {
109
+            function($a, $b) {
110 110
                 if (gettype($a) !== gettype($b)) {
111 111
                     return -1;
112 112
                 }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     /**
157 157
      * {@inheritedoc}
158 158
      */
159
-    public function forEach(callable $callback): void
159
+    public function forEach (callable $callback): void
160 160
     {
161 161
         $data = $this->all();
162 162
         array_walk($data, $callback);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
     /**
157 157
      * {@inheritedoc}
158 158
      */
159
-    public function forEach(callable $callback): void
159
+    public function foreach(callable $callback): void
160 160
     {
161 161
         $data = $this->all();
162 162
         array_walk($data, $callback);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,8 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param int $offset
178 178
      * @return T|null
179 179
      */
180
-    public function get(int $offset)
181
-    {
180
+    public function get(int $offset) {
182 181
         return $this->data->offsetGet($offset);
183 182
     }
184 183
 
@@ -211,8 +210,7 @@  discard block
 block discarded – undo
211 210
      * @return T|null
212 211
      * @throws InvalidOperationException
213 212
      */
214
-    public function rand()
215
-    {
213
+    public function rand() {
216 214
         if ($this->isEmpty()) {
217 215
             throw new InvalidOperationException('The collection is empty');
218 216
         }
Please login to merge, or discard this patch.
src/Map/HashMap.php 4 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
         $diffValues = array_udiff_uassoc(
141 141
             $this->all(),
142 142
             $collection->all(),
143
-            function ($a, $b) {
143
+            function($a, $b) {
144 144
                 return $a <=> $b;
145 145
             },
146
-            function ($c, $d) {
146
+            function($c, $d) {
147 147
                 return $c <=> $d;
148 148
             }
149 149
         );
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param callable $callback
236 236
      * @return void
237 237
      */
238
-    public function forEach(callable $callback): void
238
+    public function forEach (callable $callback): void
239 239
     {
240 240
         $data = $this->all();
241 241
         array_walk($data, $callback);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@
 block discarded – undo
235 235
      * @param callable $callback
236 236
      * @return void
237 237
      */
238
-    public function forEach(callable $callback): void
238
+    public function foreach(callable $callback): void
239 239
     {
240 240
         $data = $this->all();
241 241
         array_walk($data, $callback);
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
                 : null;
220 220
     }
221 221
 
222
-     /**
223
-      *
224
-      * @param HashMap<T> $collection
225
-      * @return bool
226
-      * @throws InvalidOperationException
227
-      */
222
+        /**
223
+         *
224
+         * @param HashMap<T> $collection
225
+         * @return bool
226
+         * @throws InvalidOperationException
227
+         */
228 228
     public function equals(BaseCollection $collection): bool
229 229
     {
230 230
         if (!$collection instanceof self) {
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
         $this->initializePairs($data);
250 250
     }
251 251
 
252
-     /**
253
-      * Return the value for given key
254
-      * @param mixed $key
255
-      * @return T|null
256
-      */
252
+        /**
253
+         * Return the value for given key
254
+         * @param mixed $key
255
+         * @return T|null
256
+         */
257 257
     public function get($key)
258 258
     {
259 259
         return $this->data->offsetExists($key)
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
                : null;
262 262
     }
263 263
 
264
-     /**
265
-     * {@inheritedoc}
266
-      * @param HashMap<T> $collection
267
-      * @return HashMap<T>
268
-     */
264
+        /**
265
+         * {@inheritedoc}
266
+         * @param HashMap<T> $collection
267
+         * @return HashMap<T>
268
+         */
269 269
     public function merge(BaseCollection $collection): BaseCollection
270 270
     {
271 271
         TypeCheck::isEqual(
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
         throw new InvalidOperationException('Can not call this method in map');
310 310
     }
311 311
 
312
-     /**
313
-     * {@inheritedoc}
314
-     */
312
+        /**
313
+         * {@inheritedoc}
314
+         */
315 315
     public function remove($key): void
316 316
     {
317 317
         if ($this->isEmpty()) {
@@ -328,12 +328,12 @@  discard block
 block discarded – undo
328 328
         $this->data->offsetUnset($key);
329 329
     }
330 330
 
331
-     /**
332
-      *
333
-      * @param int $offset
334
-      * @param int|null $length
335
-      * @return HashMap<T>|null
336
-      */
331
+        /**
332
+         *
333
+         * @param int $offset
334
+         * @param int|null $length
335
+         * @return HashMap<T>|null
336
+         */
337 337
     public function slice(int $offset, ?int $length = null): ?BaseCollection
338 338
     {
339 339
         $newData = array_slice($this->all(), $offset, $length, true);
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
             : null;
348 348
     }
349 349
 
350
-     /**
351
-      *
352
-      * @param callable $callback
353
-      * @return HashMap<T>|null
354
-      */
350
+        /**
351
+         *
352
+         * @param callable $callback
353
+         * @return HashMap<T>|null
354
+         */
355 355
     public function sort(callable $callback): ?BaseCollection
356 356
     {
357 357
         $data = $this->all();
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@  discard block
 block discarded – undo
85 85
      * @param mixed $valueType
86 86
      * @param array<mixed, T> $initials
87 87
      */
88
-    public function __construct($keyType, $valueType, array $initials = [])
89
-    {
88
+    public function __construct($keyType, $valueType, array $initials = []) {
90 89
         $this->keyType = $keyType;
91 90
         $this->valueType = $valueType;
92 91
 
@@ -158,8 +157,7 @@  discard block
 block discarded – undo
158 157
      * Return the type of the key
159 158
      * @return mixed
160 159
      */
161
-    public function getKeyType()
162
-    {
160
+    public function getKeyType() {
163 161
         return $this->keyType;
164 162
     }
165 163
 
@@ -167,8 +165,7 @@  discard block
 block discarded – undo
167 165
      * Return the type of the value
168 166
      * @return mixed
169 167
      */
170
-    public function getValueType()
171
-    {
168
+    public function getValueType() {
172 169
         return $this->valueType;
173 170
     }
174 171
 
@@ -254,8 +251,7 @@  discard block
 block discarded – undo
254 251
       * @param mixed $key
255 252
       * @return T|null
256 253
       */
257
-    public function get($key)
258
-    {
254
+    public function get($key) {
259 255
         return $this->data->offsetExists($key)
260 256
                ? $this->data->offsetGet($key)->getValue()
261 257
                : null;
@@ -296,16 +292,14 @@  discard block
 block discarded – undo
296 292
     /**
297 293
      * {@inheritedoc}
298 294
      */
299
-    public function first()
300
-    {
295
+    public function first() {
301 296
         throw new InvalidOperationException('Can not call this method in map');
302 297
     }
303 298
 
304 299
     /**
305 300
      * {@inheritedoc}
306 301
      */
307
-    public function last()
308
-    {
302
+    public function last() {
309 303
         throw new InvalidOperationException('Can not call this method in map');
310 304
     }
311 305
 
Please login to merge, or discard this patch.
src/Collection.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $diffValues = array_udiff(
167 167
             $this->all(),
168 168
             $collection->all(),
169
-            function ($a, $b) {
169
+            function($a, $b) {
170 170
                 return $a <=> $b;
171 171
             }
172 172
         );
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     /**
235 235
      * {@inheritedoc}
236 236
      */
237
-    public function forEach(callable $callback): void
237
+    public function forEach (callable $callback): void
238 238
     {
239 239
         $data = $this->all();
240 240
         array_walk($data, $callback);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
     /**
157 157
      * {@inheritedoc}
158 158
      */
159
-    public function forEach(callable $callback): void
159
+    public function foreach(callable $callback): void
160 160
     {
161 161
         $data = $this->all();
162 162
         array_walk($data, $callback);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@  discard block
 block discarded – undo
74 74
      * @param array<mixed, mixed> $data
75 75
      * @param string $type
76 76
      */
77
-    public function __construct(array $data = [], string $type = '')
78
-    {
77
+    public function __construct(array $data = [], string $type = '') {
79 78
         $this->type = $type;
80 79
 
81 80
         foreach ($data as $value) {
@@ -183,8 +182,7 @@  discard block
 block discarded – undo
183 182
      * @return mixed
184 183
      * @throws OutOfRangeException
185 184
      */
186
-    public function get(int $offset)
187
-    {
185
+    public function get(int $offset) {
188 186
         if ($this->isEmpty()) {
189 187
             throw new OutOfRangeException('The collection is empty');
190 188
         }
@@ -271,8 +269,7 @@  discard block
 block discarded – undo
271 269
      * Return a random element of the collection
272 270
      * @return mixed
273 271
      */
274
-    public function rand()
275
-    {
272
+    public function rand() {
276 273
         if ($this->isEmpty()) {
277 274
             throw new InvalidOperationException('The collection is empty');
278 275
         }
Please login to merge, or discard this patch.
src/ObjectCollection.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,15 +52,13 @@
 block discarded – undo
52 52
  *
53 53
  * @extends TypedCollection<object>
54 54
  */
55
-class ObjectCollection extends TypedCollection
56
-{
55
+class ObjectCollection extends TypedCollection {
57 56
 
58 57
     /**
59 58
      * Create new instance
60 59
      * @param array<mixed, object> $data
61 60
      */
62
-    public function __construct(array $data = [])
63
-    {
61
+    public function __construct(array $data = []) {
64 62
         parent::__construct('object', $data);
65 63
     }
66 64
 }
Please login to merge, or discard this patch.
src/BaseCollection.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@  discard block
 block discarded – undo
70 70
      * Create new instance
71 71
      * @param array<mixed, T> $initials
72 72
      */
73
-    public function __construct(array $initials = [])
74
-    {
73
+    public function __construct(array $initials = []) {
75 74
         $this->data = new DataContainer($initials);
76 75
     }
77 76
 
@@ -108,8 +107,7 @@  discard block
 block discarded – undo
108 107
      * Return the first element of collection
109 108
      * @return T
110 109
      */
111
-    public function first()
112
-    {
110
+    public function first() {
113 111
         if ($this->isEmpty()) {
114 112
             throw new OutOfRangeException('The collection is empty');
115 113
         }
@@ -122,8 +120,7 @@  discard block
 block discarded – undo
122 120
      * Return the last element of collection
123 121
      * @return T
124 122
      */
125
-    public function last()
126
-    {
123
+    public function last() {
127 124
         if ($this->isEmpty()) {
128 125
             throw new OutOfRangeException('The collection is empty');
129 126
         }
Please login to merge, or discard this patch.
src/TypedCollection.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,16 +52,14 @@
 block discarded – undo
52 52
  * @template T
53 53
  * @extends Collection<T>
54 54
  */
55
-class TypedCollection extends Collection
56
-{
55
+class TypedCollection extends Collection {
57 56
 
58 57
     /**
59 58
      * Create new instance
60 59
      * @param string $type
61 60
      * @param array<mixed, T> $data
62 61
      */
63
-    public function __construct(string $type, array $data = [])
64
-    {
62
+    public function __construct(string $type, array $data = []) {
65 63
         parent::__construct($data, $type);
66 64
     }
67 65
 
Please login to merge, or discard this patch.
src/DataContainer.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@  discard block
 block discarded – undo
70 70
      * Create new instance
71 71
      * @param array<mixed, T> $data
72 72
      */
73
-    public function __construct(array $data = [])
74
-    {
73
+    public function __construct(array $data = []) {
75 74
         $this->data = $data;
76 75
     }
77 76
 
@@ -121,8 +120,7 @@  discard block
 block discarded – undo
121 120
      * @param mixed $offset
122 121
      * @return mixed
123 122
      */
124
-    public function offsetGet($offset)
125
-    {
123
+    public function offsetGet($offset) {
126 124
         return isset($this->data[$offset])
127 125
                 ? $this->data[$offset]
128 126
                 : null;
Please login to merge, or discard this patch.