Completed
Push — master ( 4909d1...1b9670 )
by Jean
02:08
created
src/polyfills.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!function_exists('spl_object_id')) {
2
+if ( ! function_exists('spl_object_id')) {
3 3
     /**
4 4
      * @see https://secure.php.net/manual/en/function.spl-object-id.php
5 5
      * This method doesn't exist before PHP 7.2.0
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     }
13 13
 }
14 14
 
15
-if (!function_exists('is_iterable')) {
15
+if ( ! function_exists('is_iterable')) {
16 16
     /**
17 17
      * @see https://github.com/symfony/polyfill-php71/commit/36004d119352f4506398032259a08e4ca9607285
18 18
      * This method doesn't exist before PHP 7.1.0
Please login to merge, or discard this patch.
src/Arrays/ChainableArray.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     /**
29 29
      */
30
-    public static function from($data=[], $isConstant=false)
30
+    public static function from($data = [], $isConstant = false)
31 31
     {
32 32
         Arrays::mustBeCountable($data);
33 33
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     /**
41 41
      */
42
-    public function __construct(array $data=[], $isConstant=false)
42
+    public function __construct(array $data = [], $isConstant = false)
43 43
     {
44 44
         $this->data       = $data;
45 45
         $this->isConstant = $isConstant;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @return ChainableArray $this
85 85
      */
86
-    public function setConstant($state=true)
86
+    public function setConstant($state = true)
87 87
     {
88 88
         $this->isConstant = $state;
89 89
         return $this;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     /**
163 163
      * Checks if an argument is an array or a ChainableArray
164 164
      */
165
-    private function argumentIsArrayOrArrayObject( $argument )
165
+    private function argumentIsArrayOrArrayObject($argument)
166 166
     {
167 167
         return is_array($argument)
168 168
             || $argument instanceof ChainableArray;
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
         $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 20);
178 178
         $i      = 1;
179 179
         $caller = $backtrace[$i];
180
-        while (     isset($backtrace[$i]['class'])
181
-                &&  $backtrace[$i]['class'] == __CLASS__ ) {
180
+        while (isset($backtrace[$i]['class'])
181
+                &&  $backtrace[$i]['class'] == __CLASS__) {
182 182
             $caller = $backtrace[$i];
183 183
             $i++;
184 184
         }
185 185
 
186 186
         $exception = new \ErrorException($message);
187 187
 
188
-        $reflectionClass = new \ReflectionClass( get_class($exception) );
188
+        $reflectionClass = new \ReflectionClass(get_class($exception));
189 189
 
190 190
         //file
191 191
         $reflectionProperty = $reflectionClass->getProperty('file');
Please login to merge, or discard this patch.
src/Arrays/ChainableArray_NativeFunctions_Trait.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *                              The current key we be kept if null.
22 22
      * @return $this
23 23
      */
24
-    public function columns($column_names, $index_key=null)
24
+    public function columns($column_names, $index_key = null)
25 25
     {
26 26
         $out = [];
27 27
         foreach ($this->data as $key => &$row) {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             if (is_array($column_names)) {
33 33
                 $out[$key] = [];
34 34
                 foreach ($column_names as $column_name) {
35
-                    if (!array_key_exists($column_name, $row)) {
35
+                    if ( ! array_key_exists($column_name, $row)) {
36 36
                         self::throwUsageException(
37 37
                              "Trying to extract a column from a row which"
38 38
                             ." doesn't contain it : '$column_name' \n"
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                     $keys = [];
61 61
                 }
62 62
 
63
-                if (!in_array($column_names, $keys)) {
63
+                if ( ! in_array($column_names, $keys)) {
64 64
                     self::throwUsageException('A row have no index to '
65 65
                         .'fill the column: '.$column_names."\n"
66 66
                         .$key.' => '.var_export($row, true));
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      *
79 79
      * @deprecated Use columns() instead
80 80
      */
81
-    public function column($column_names, $index_key=null)
81
+    public function column($column_names, $index_key = null)
82 82
     {
83 83
         return $this->columns($column_names, $index_key);
84 84
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param  $default_value To use if the array is empty
100 100
      * @return array The min.
101 101
      */
102
-    public function min($default_value=null)
102
+    public function min($default_value = null)
103 103
     {
104 104
         if ($this->isEmpty() && $default_value !== null)
105 105
             return $default_value;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param  $default_value To use if the array is empty
123 123
      * @return array The max.
124 124
      */
125
-    public function max($default_value=null)
125
+    public function max($default_value = null)
126 126
     {
127 127
         if ($this->isEmpty() && $default_value !== null)
128 128
             return $default_value;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      *
180 180
      * @return static $this or a new static.
181 181
      */
182
-    public function filter($callback=null)
182
+    public function filter($callback = null)
183 183
     {
184 184
         if ($callback) {
185 185
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 $callback = new \JClaveau\LogicalFilter\LogicalFilter($callback);
188 188
             }
189 189
 
190
-            if (!is_callable($callback)) {
190
+            if ( ! is_callable($callback)) {
191 191
                 $this->throwUsageException(
192 192
                     "\$callback must be a logical filter description array or a callable"
193 193
                     ." instead of "
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
             else {
205 205
                 $out = $this->data;
206 206
                 foreach ($out as $key => $value) {
207
-                    if (!$callback($value, $key))
208
-                        unset( $out[$key] );
207
+                    if ( ! $callback($value, $key))
208
+                        unset($out[$key]);
209 209
                 }
210 210
             }
211 211
         }
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
      *
225 225
      * @return static $this or a new static.
226 226
      */
227
-    public function filterKey(callable $callback=null)
227
+    public function filterKey(callable $callback = null)
228 228
     {
229 229
         throw new \ErrorException('This method is replaced by '
230
-            . __TRAIT__ . '::filtr()');
230
+            . __TRAIT__.'::filtr()');
231 231
     }
232 232
 
233 233
     /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function intersectKey($intersect_with)
260 260
     {
261
-        if (!$this->argumentIsArrayOrArrayObject($intersect_with))
261
+        if ( ! $this->argumentIsArrayOrArrayObject($intersect_with))
262 262
             self::throwUsageException("First argument must be an array or a ".static::class.".");
263 263
 
264 264
         if ($intersect_with instanceof static)
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     public function unshift()
299 299
     {
300 300
         $data = $this->data;
301
-        $arguments = Arrays::merge( [&$data], func_get_args() );
301
+        $arguments = Arrays::merge([&$data], func_get_args());
302 302
 
303 303
         call_user_func_array('array_unshift', $arguments);
304 304
         return $this->returnConstant($data);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     public function push()
313 313
     {
314 314
         $data = $this->data;
315
-        $arguments = Arrays::merge( [&$data], func_get_args() );
315
+        $arguments = Arrays::merge([&$data], func_get_args());
316 316
 
317 317
         call_user_func_array('array_push', $arguments);
318 318
         return $this->returnConstant($data);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      *
324 324
      * @return static $this or a new static.
325 325
      */
326
-    public function unique($flags=SORT_STRING)
326
+    public function unique($flags = SORT_STRING)
327 327
     {
328 328
         $out = array_unique($this->data, $flags);
329 329
         return $this->returnConstant($out);
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
      *
350 350
      * @return static $this or a new static.
351 351
      */
352
-    public function diff($compare_with, $check_keys=false, $strict_comparison=false)
352
+    public function diff($compare_with, $check_keys = false, $strict_comparison = false)
353 353
     {
354
-        if (!$this->argumentIsArrayOrArrayObject($compare_with))
354
+        if ( ! $this->argumentIsArrayOrArrayObject($compare_with))
355 355
             self::throwUsageException("First argument must be an iterable");
356 356
 
357 357
         $kept_values = $this->data;
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
                 if ($check_keys) {
365 365
 
366 366
                     if ($strict_comparison) {
367
-                        if (    $kept_key   === $compared_key
368
-                            &&  $kept_value === $compared_value ) {
367
+                        if ($kept_key === $compared_key
368
+                            &&  $kept_value === $compared_value) {
369 369
                             $is_equal = true;
370 370
                         }
371 371
                     }
372 372
                     else {
373
-                        if (    $kept_key   == $compared_key
374
-                            &&  $kept_value == $compared_value ) {
373
+                        if ($kept_key == $compared_key
374
+                            &&  $kept_value == $compared_value) {
375 375
                             $is_equal = true;
376 376
                         }
377 377
                     }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
                 if ($is_equal) {
393 393
                     // Debug::dumpJson($kept_key, !true);
394
-                    unset($kept_values[ $kept_key ]);
394
+                    unset($kept_values[$kept_key]);
395 395
                     break;
396 396
                 }
397 397
             }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
      */
422 422
     public function fillKeys($keys, $value)
423 423
     {
424
-        if (!$this->argumentIsArrayOrArrayObject($keys))
424
+        if ( ! $this->argumentIsArrayOrArrayObject($keys))
425 425
             self::throwUsageException("First argument must be an array or a ".static::class.".");
426 426
 
427 427
         if ($keys instanceof static)
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
      *
439 439
      * @return static The filled array.
440 440
      */
441
-    public function fill($start, $number, $value, $interval=1)
441
+    public function fill($start, $number, $value, $interval = 1)
442 442
     {
443 443
         $out = [];
444 444
         while ($number >= 0) {
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
         $zero_key,
469 469
         $end_key,
470 470
         callable $step_generator,
471
-        $max_interations_count=1000
472
-    ){
471
+        $max_interations_count = 1000
472
+    ) {
473 473
         if ($max_interations_count < 0)
474 474
             throw new \InvalidArgumentException("$maximum_interations_count must be positive");
475 475
 
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
         $iterations_count    = 0;
480 480
 
481 481
         while ($iterations_count <= $max_interations_count) {
482
-            $current_step_value = call_user_func_array( $step_generator, [
483
-                &$current_step_key,   // param by reference
482
+            $current_step_value = call_user_func_array($step_generator, [
483
+                &$current_step_key, // param by reference
484 484
                 $previous_step_value,
485
-                $current_step_key,   // not passed by ref
485
+                $current_step_key, // not passed by ref
486 486
                 $out
487 487
             ]);
488 488
 
489 489
             if ($current_step_key === null) {
490 490
                 $out[] = $current_step_value;
491 491
             }
492
-            elseif (!is_int($current_step_key)) {
492
+            elseif ( ! is_int($current_step_key)) {
493 493
                 // Set the local as en_US tu have floats formatted with
494 494
                 // "." as separator
495 495
                 // TODO : could it be useful for dates to?
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
      *
528 528
      * @return array The keys.
529 529
      */
530
-    public function keys($search_value=null, $strict=false)
530
+    public function keys($search_value = null, $strict = false)
531 531
     {
532 532
         if ($search_value)
533 533
             return array_keys($this->data, $search_value, $strict);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
      *
560 560
      * @return string The array written in PHP code.
561 561
      */
562
-    public function export($return=true)
562
+    public function export($return = true)
563 563
     {
564 564
         return var_export($this->data, $return);
565 565
     }
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
      * @param  bool $return Should we print it or return it?
573 573
      * @return string The printed array
574 574
      */
575
-    public function print_($return=false)
575
+    public function print_($return = false)
576 576
     {
577
-        if (!$return) {
577
+        if ( ! $return) {
578 578
 
579 579
             echo '<pre>';
580 580
             print_r($this->data);
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
      *
635 635
      * @see http://php.net/manual/fr/function.prev.php
636 636
      */
637
-    public function usort(callable $callback=null)
637
+    public function usort(callable $callback = null)
638 638
     {
639 639
         $data = $this->data;
640 640
 
@@ -647,9 +647,9 @@  discard block
 block discarded – undo
647 647
             };
648 648
         }
649 649
 
650
-        $arguments = Arrays::merge( [&$data], [$callback] );
650
+        $arguments = Arrays::merge([&$data], [$callback]);
651 651
 
652
-        if ( ! call_user_func_array('uasort', $arguments) )
652
+        if ( ! call_user_func_array('uasort', $arguments))
653 653
             throw new \ErrorException('Unable to apply usort');
654 654
 
655 655
         return $this->returnConstant($data);
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
      *
661 661
      * @see http://php.net/manual/fr/function.uksort.php
662 662
      */
663
-    public function uksort(callable $callback=null)
663
+    public function uksort(callable $callback = null)
664 664
     {
665 665
         $data = $this->data;
666 666
 
@@ -670,9 +670,9 @@  discard block
 block discarded – undo
670 670
             };
671 671
         }
672 672
 
673
-        $arguments = Arrays::merge( [&$data], [$callback] );
673
+        $arguments = Arrays::merge([&$data], [$callback]);
674 674
 
675
-        if ( ! call_user_func_array('uksort', $arguments) )
675
+        if ( ! call_user_func_array('uksort', $arguments))
676 676
             throw new \ErrorException('Unable to apply uksort');
677 677
 
678 678
         return $this->returnConstant($data);
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
      */
687 687
     public function intersect($intersect_with)
688 688
     {
689
-        if (!$this->argumentIsArrayOrArrayObject($intersect_with)) {
689
+        if ( ! $this->argumentIsArrayOrArrayObject($intersect_with)) {
690 690
             $this->throwUsageException("First argument must be an array or a ".static::class.".");
691 691
         }
692 692
 
Please login to merge, or discard this patch.
src/Arrays/ChainableArray_ArrayAccess_Trait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
             // The true location of the throw is still available through
87 87
             // $e->getTrace()
88 88
             $trace_location  = $e->getTrace()[1];
89
-            $reflectionClass = new \ReflectionClass( get_class($e) );
89
+            $reflectionClass = new \ReflectionClass(get_class($e));
90 90
 
91 91
             //file
92 92
             if (isset($trace_location['file'])) {
Please login to merge, or discard this patch.
src/Arrays/ChainableArray_Wip_Trait.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $column_name = $key_column_names->shift();
93 93
 
94
-        if (!$column_name)
94
+        if ( ! $column_name)
95 95
             return $rows;
96 96
 
97 97
         // $out = new static;
@@ -212,85 +212,85 @@  discard block
 block discarded – undo
212 212
             '3rd'
213 213
         ]);
214 214
 
215
-        $expected = array (
216
-            0 => array (
215
+        $expected = array(
216
+            0 => array(
217 217
                 'a3' => 1,
218 218
                 'b3' => 1,
219 219
                 '3rd' => 'a2',
220 220
                 '2nd' => 'a1',
221 221
                 '1st' => 'a',
222 222
             ),
223
-            1 => array (
223
+            1 => array(
224 224
                 'a3' => 1,
225 225
                 'b3' => 1,
226 226
                 '3rd' => 'b2',
227 227
                 '2nd' => 'a1',
228 228
                 '1st' => 'a',
229 229
             ),
230
-            2 => array (
230
+            2 => array(
231 231
                 'a3' => 1,
232 232
                 'b3' => 1,
233 233
                 '3rd' => 'c2',
234 234
                 '2nd' => 'a1',
235 235
                 '1st' => 'a',
236 236
             ),
237
-            3 => array (
237
+            3 => array(
238 238
                 'a3' => 1,
239 239
                 'b3' => 1,
240 240
                 '3rd' => 'a2',
241 241
                 '2nd' => 'b1',
242 242
                 '1st' => 'a',
243 243
             ),
244
-            4 => array (
244
+            4 => array(
245 245
                 'a3' => 1,
246 246
                 'b3' => 1,
247 247
                 '3rd' => 'b2',
248 248
                 '2nd' => 'b1',
249 249
                 '1st' => 'a',
250 250
             ),
251
-            5 => array (
251
+            5 => array(
252 252
                 'a3' => 1,
253 253
                 'b3' => 1,
254 254
                 '3rd' => 'c2',
255 255
                 '2nd' => 'b1',
256 256
                 '1st' => 'a',
257 257
             ),
258
-            6 => array (
258
+            6 => array(
259 259
                 'a3' => 1,
260 260
                 'b3' => 1,
261 261
                 '3rd' => 'a2',
262 262
                 '2nd' => 'a1',
263 263
                 '1st' => 'b',
264 264
             ),
265
-            7 => array (
265
+            7 => array(
266 266
                 'a3' => 1,
267 267
                 'b3' => 1,
268 268
                 '3rd' => 'b2',
269 269
                 '2nd' => 'a1',
270 270
                 '1st' => 'b',
271 271
             ),
272
-            8 => array (
272
+            8 => array(
273 273
                 'a3' => 1,
274 274
                 'b3' => 1,
275 275
                 '3rd' => 'c2',
276 276
                 '2nd' => 'a1',
277 277
                 '1st' => 'b',
278 278
             ),
279
-            9 => array (
279
+            9 => array(
280 280
                 'a3' => 1,
281 281
                 'b3' => 1,
282 282
                 '3rd' => 'a2',
283 283
                 '2nd' => 'b1',
284 284
                 '1st' => 'b',
285 285
             ),
286
-            10 => array (
286
+            10 => array(
287 287
                 'a3' => 1,
288 288
                 'b3' => 1,
289 289
                 '3rd' => 'b2',
290 290
                 '2nd' => 'b1',
291 291
                 '1st' => 'b',
292 292
             ),
293
-            11 => array (
293
+            11 => array(
294 294
                 'a3' => 1,
295 295
                 'b3' => 1,
296 296
                 '3rd' => 'c2',
@@ -327,19 +327,19 @@  discard block
 block discarded – undo
327 327
      */
328 328
     private function piramidize_aux($key_column_names, $rows)
329 329
     {
330
-        if (!is_array($rows))
330
+        if ( ! is_array($rows))
331 331
             return $rows;
332 332
 
333 333
         $column_name = $key_column_names->shift();
334 334
 
335
-        if (!$column_name)
335
+        if ( ! $column_name)
336 336
             return $rows;
337 337
 
338 338
         // $out = new static;
339 339
         $out = [];
340 340
         foreach ($rows as $key => $row) {
341 341
 
342
-            if (!isset($row[$column_name])) {
342
+            if ( ! isset($row[$column_name])) {
343 343
                 throw new \ErrorException("No value found for column"
344 344
                     ." name '$column_name' in the row: ".var_export($row, true));
345 345
             }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             unset($row[$column_name]);
349 349
 
350 350
             if ($key_column_names->count()) {
351
-                if (!isset($out[$key]))
351
+                if ( ! isset($out[$key]))
352 352
                     $out[$key] = [];
353 353
 
354 354
                 $out[$key][] = $row;
@@ -456,68 +456,68 @@  discard block
 block discarded – undo
456 456
             '1st',
457 457
         ]);
458 458
 
459
-        $expected = array (
460
-            'a2' => array (
461
-                'a1' => array (
462
-                    'a' => array (
459
+        $expected = array(
460
+            'a2' => array(
461
+                'a1' => array(
462
+                    'a' => array(
463 463
                         'a3' => 1,
464 464
                         'b3' => 1,
465 465
                     ),
466
-                    'b' => array (
466
+                    'b' => array(
467 467
                         'a3' => 1,
468 468
                         'b3' => 1,
469 469
                     ),
470 470
                 ),
471
-                'b1' => array (
472
-                    'a' => array (
471
+                'b1' => array(
472
+                    'a' => array(
473 473
                         'a3' => 1,
474 474
                         'b3' => 1,
475 475
                     ),
476
-                    'b' => array (
476
+                    'b' => array(
477 477
                         'a3' => 1,
478 478
                         'b3' => 1,
479 479
                     ),
480 480
                 ),
481 481
             ),
482
-            'b2' => array (
483
-                'a1' => array (
484
-                    'a' => array (
482
+            'b2' => array(
483
+                'a1' => array(
484
+                    'a' => array(
485 485
                         'a3' => 2,
486 486
                         'b3' => 2,
487 487
                     ),
488
-                    'b' => array (
488
+                    'b' => array(
489 489
                         'a3' => 2,
490 490
                         'b3' => 2,
491 491
                     ),
492 492
                 ),
493
-                'b1' => array (
494
-                    'a' => array (
493
+                'b1' => array(
494
+                    'a' => array(
495 495
                         'a3' => 2,
496 496
                         'b3' => 2,
497 497
                     ),
498
-                    'b' => array (
498
+                    'b' => array(
499 499
                         'a3' => 2,
500 500
                         'b3' => 2,
501 501
                     ),
502 502
                 ),
503 503
             ),
504
-            'c2' => array (
505
-                'a1' => array (
506
-                    'a' => array (
504
+            'c2' => array(
505
+                'a1' => array(
506
+                    'a' => array(
507 507
                         'a3' => 3,
508 508
                         'b3' => 3,
509 509
                     ),
510
-                    'b' => array (
510
+                    'b' => array(
511 511
                         'a3' => 3,
512 512
                         'b3' => 3,
513 513
                     ),
514 514
                 ),
515
-                'b1' => array (
516
-                    'a' => array (
515
+                'b1' => array(
516
+                    'a' => array(
517 517
                         'a3' => 3,
518 518
                         'b3' => 3,
519 519
                     ),
520
-                    'b' => array (
520
+                    'b' => array(
521 521
                         'a3' => 3,
522 522
                         'b3' => 3,
523 523
                     ),
Please login to merge, or discard this patch.
src/Arrays/ChainableArray_Utils_Trait.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      *
19 19
      * @return array The array containing the grouped rows.
20 20
      */
21
-    public function groupBy( callable $indexGenerator, callable $conflictResolver=null )
21
+    public function groupBy(callable $indexGenerator, callable $conflictResolver = null)
22 22
     {
23 23
         // todo : this doesn't work
24 24
         // return $this->groupByTransformed($indexGenerator, null, $conflictResolver);
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
         $out = [];
27 27
         foreach ($this->data as $key => $row) {
28 28
 
29
-            if (!$row)
29
+            if ( ! $row)
30 30
                 continue;
31 31
 
32 32
             $newIndexes     = call_user_func($indexGenerator, $key, $row);
33
-            if (!is_array($newIndexes))
33
+            if ( ! is_array($newIndexes))
34 34
                 $newIndexes = [$newIndexes];
35 35
 
36 36
             foreach ($newIndexes as $newIndex) {
37
-                if (!isset($out[$newIndex])) {
37
+                if ( ! isset($out[$newIndex])) {
38 38
                     $out[$newIndex] = $row;
39 39
                 }
40 40
                 else {
@@ -69,26 +69,26 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return array The array containing the grouped rows.
71 71
      */
72
-    public function groupInArrays( callable $indexGenerator )
72
+    public function groupInArrays(callable $indexGenerator)
73 73
     {
74 74
         $out = [];
75 75
         foreach ($this->data as $key => $row) {
76 76
 
77
-            if (!$row)
77
+            if ( ! $row)
78 78
                 continue;
79 79
 
80 80
             $new_keys = call_user_func($indexGenerator, $row, $key);
81
-            if (!is_array($new_keys))
81
+            if ( ! is_array($new_keys))
82 82
                 $new_keys = [$new_keys];
83 83
 
84 84
             foreach ($new_keys as $new_key) {
85
-                if (!isset($out[ $new_key ])) {
86
-                    $out[ $new_key ] = [
85
+                if ( ! isset($out[$new_key])) {
86
+                    $out[$new_key] = [
87 87
                         $key => $row
88 88
                     ];
89 89
                 }
90 90
                 else {
91
-                    $out[ $new_key ][ $key ] = $row;
91
+                    $out[$new_key][$key] = $row;
92 92
                 }
93 93
             }
94 94
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public function groupByTransformed(
114 114
         callable $indexGenerator,
115
-        callable $rowTransformer,      // todo check this behavior
115
+        callable $rowTransformer, // todo check this behavior
116 116
         callable $conflictResolver )
117 117
     {
118 118
         // The goal here is to remove the second parameter has it makes the
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $out = [];
126 126
         foreach ($this->data as $key => $row) {
127 127
 
128
-            if (!$row)
128
+            if ( ! $row)
129 129
                 continue;
130 130
 
131 131
             $newIndex       = call_user_func($indexGenerator, $key, $row);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                             ? call_user_func($rowTransformer, $row)
135 135
                             : $row;
136 136
 
137
-            if (!isset($out[$newIndex])) {
137
+            if ( ! isset($out[$newIndex])) {
138 138
                 $out[$newIndex] = $transformedRow;
139 139
             }
140 140
             else {
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
      *                                       rows have the same index.
160 160
      * @return static
161 161
      */
162
-    public function mergeWith( $otherTable, callable $conflictResolver=null )
162
+    public function mergeWith($otherTable, callable $conflictResolver = null)
163 163
     {
164 164
         if (is_array($otherTable))
165 165
             $otherTable = new static($otherTable);
166 166
 
167
-        if (!$otherTable instanceof static) {
167
+        if ( ! $otherTable instanceof static) {
168 168
             self::throwUsageException(
169 169
                 '$otherTable must be an array or an instance of '.static::class.' instead of: '
170 170
                 .var_export($otherTable, true)
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $out = $this->data;
175 175
         foreach ($otherTable->getArray() as $key => $row) {
176 176
 
177
-            if (!isset($out[$key])) {
177
+            if ( ! isset($out[$key])) {
178 178
                 $out[$key] = $row;
179 179
             }
180 180
             else {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      * (same as self::mergeWith with the other table as $this)
203 203
      * @return static
204 204
      */
205
-    public function mergeIn( $otherTable, callable $conflictResolver=null )
205
+    public function mergeIn($otherTable, callable $conflictResolver = null)
206 206
     {
207 207
         $otherTable->mergeWith($this, $conflictResolver);
208 208
         return $this;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function each(callable $rowTransformer)
230 230
     {
231
-        $out  = [];
231
+        $out = [];
232 232
         foreach ($this->data as $key => $row) {
233 233
             $out[$key] = call_user_func_array(
234 234
                 $rowTransformer,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function renameColumns(array $old_to_new_names)
260 260
     {
261
-        $out  = [];
261
+        $out = [];
262 262
         foreach ($this->data as $key => $row) {
263 263
             try {
264 264
                 foreach ($old_to_new_names as $old_name => $new_name) {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 }
268 268
             }
269 269
             catch (\Exception $e) {
270
-                self::throwUsageException( $e->getMessage() );
270
+                self::throwUsageException($e->getMessage());
271 271
             }
272 272
 
273 273
             $out[$key] = $row;
@@ -319,20 +319,20 @@  discard block
 block discarded – undo
319 319
      *                            nor a static.
320 320
      * @return static       $this
321 321
      */
322
-    public function append($new_rows, callable $conflict_resolver=null)
322
+    public function append($new_rows, callable $conflict_resolver = null)
323 323
     {
324 324
         if ($new_rows instanceof static)
325 325
             $new_rows = $new_rows->getArray();
326 326
 
327
-        if (!is_array($new_rows)) {
327
+        if ( ! is_array($new_rows)) {
328 328
             $this->throwUsageException(
329
-                "\$new_rows parameter must be an array or an instance of " . __CLASS__
329
+                "\$new_rows parameter must be an array or an instance of ".__CLASS__
330 330
             );
331 331
         }
332 332
 
333
-        if (!$conflict_resolver) {
333
+        if ( ! $conflict_resolver) {
334 334
             // default conflict resolver: append with numeric key
335
-            $conflict_resolver = function (&$data, $existing_row, $confliuct_row, $key) {
335
+            $conflict_resolver = function(&$data, $existing_row, $confliuct_row, $key) {
336 336
                 $data[] = $confliuct_row;
337 337
             };
338 338
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      *
365 365
      * @return static
366 366
      */
367
-    public function dimensionsAsColumns(array $columnNames, array $options=null)
367
+    public function dimensionsAsColumns(array $columnNames, array $options = null)
368 368
     {
369 369
         $out = $this->dimensionsAsColumns_recurser($this->data, $columnNames);
370 370
         return $this->returnConstant($out);
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
      *      ],
402 402
      * ]
403 403
      */
404
-    protected function dimensionsAsColumns_recurser(array $data, $columnNames, $rowIdParts=[])
404
+    protected function dimensionsAsColumns_recurser(array $data, $columnNames, $rowIdParts = [])
405 405
     {
406 406
         $out = [];
407 407
         // if (!$columnNames)
408 408
             // return $data;
409
-        $no_more_column = !(bool) $columnNames;
409
+        $no_more_column = ! (bool) $columnNames;
410 410
 
411 411
         // If all the names have been given to the dimensions
412 412
         // we compile the index key of the row at the current level
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
                     self::throwUsageException(
431 431
                          "Trying to populate a column '$name' that "
432 432
                         ."already exists with a different value "
433
-                        .var_export($data[$name], true). " => '$value'"
433
+                        .var_export($data[$name], true)." => '$value'"
434 434
                     );
435 435
                 }
436 436
                 $data[$name] = $value;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             }
462 462
             else {
463 463
 
464
-                if (!isset($rows)) {
464
+                if ( ! isset($rows)) {
465 465
                     echo json_encode([
466 466
                         '$rowIdParts' => $rowIdParts,
467 467
                         '$row' => $row,
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
     /**
490 490
      * Returns the first element of the array
491 491
      */
492
-    public function first($strict=false)
492
+    public function first($strict = false)
493 493
     {
494
-        if (!$this->count()) {
494
+        if ( ! $this->count()) {
495 495
             if ($strict)
496 496
                 throw new \ErrorException("No first element found in this array");
497 497
             else
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
      *
512 512
      * @todo Preserve the offset
513 513
      */
514
-    public function last($strict=false)
514
+    public function last($strict = false)
515 515
     {
516
-        if (!$this->count()) {
516
+        if ( ! $this->count()) {
517 517
             if ($strict)
518 518
                 throw new \ErrorException("No last element found in this array");
519 519
             else
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
     /**
532 532
      *
533 533
      */
534
-    public function firstKey($strict=false)
534
+    public function firstKey($strict = false)
535 535
     {
536
-        if (!$this->count()) {
536
+        if ( ! $this->count()) {
537 537
             if ($strict)
538 538
                 throw new \ErrorException("No last element found in this array");
539 539
             else
@@ -552,16 +552,16 @@  discard block
 block discarded – undo
552 552
     /**
553 553
      *
554 554
      */
555
-    public function lastKey($strict=false)
555
+    public function lastKey($strict = false)
556 556
     {
557
-        if (!$this->count()) {
557
+        if ( ! $this->count()) {
558 558
             if ($strict)
559 559
                 throw new \ErrorException("No last element found in this array");
560 560
             else
561 561
                 $lastKey = null;
562 562
         }
563 563
         else {
564
-            $key  = key($this->data);
564
+            $key = key($this->data);
565 565
             end($this->data);
566 566
             $lastKey = key($this->data);
567 567
             $this->move($key);
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
     /**
574 574
      * Move the internal pointer of the array to the key given as parameter
575 575
      */
576
-    public function move($key, $strict=true)
576
+    public function move($key, $strict = true)
577 577
     {
578 578
         if (array_key_exists($key, $this->data)) {
579 579
             foreach ($this->data as $i => &$value) {
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
      * @see http://php.net/manual/fr/function.var-dump.php
641 641
      * @todo Handle xdebug dump formatting
642 642
      */
643
-    public function dump($exit=false)
643
+    public function dump($exit = false)
644 644
     {
645 645
         $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
646 646
         $caller = $bt[0];
647 647
 
648 648
         var_export([
649
-            'location' => $caller['file'] . ':' . $caller['line'],
649
+            'location' => $caller['file'].':'.$caller['line'],
650 650
             'data'     => $this->data,
651 651
         ]);
652 652
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
      * @todo move it to an Arrays class storing static methods
664 664
      */
665 665
     public static function replaceEntries(
666
-        array $array, callable $replacer, $max_depth=null
666
+        array $array, callable $replacer, $max_depth = null
667 667
     ) {
668 668
         foreach ($array as $key => &$row) {
669 669
             $arguments = [&$row, $key];
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 
672 672
             if (is_array($row) && $max_depth !== 0) { // allowing null to have no depth limit
673 673
                 $row = self::replaceEntries(
674
-                    $row, $replacer, $max_depth ? $max_depth-1 : $max_depth
674
+                    $row, $replacer, $max_depth ? $max_depth - 1 : $max_depth
675 675
                 );
676 676
             }
677 677
         }
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
      *
688 688
      * @return static $this or a new static.
689 689
      */
690
-    public function extract($callback=null)
690
+    public function extract($callback = null)
691 691
     {
692 692
         if ($callback) {
693 693
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
                 $callback = new \JClaveau\LogicalFilter\LogicalFilter($callback);
696 696
             }
697 697
 
698
-            if (!is_callable($callback)) {
698
+            if ( ! is_callable($callback)) {
699 699
                 $this->throwUsageException(
700 700
                     "\$callback must be a logical filter description array or a callable"
701 701
                     ." instead of "
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
             foreach ($this->data as $key => $value) {
708 708
                 if ($callback($value, $key)) {
709 709
                     $out[$key] = $value;
710
-                    unset( $this->data[$key] );
710
+                    unset($this->data[$key]);
711 711
                 }
712 712
             }
713 713
         }
Please login to merge, or discard this patch.
src/Arrays/Arrays.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
     public static function mergeRecursiveCustom(
136 136
         $existing_row,
137 137
         $conflict_row,
138
-        callable $merge_resolver=null,
139
-        $max_depth=null
140
-    ){
138
+        callable $merge_resolver = null,
139
+        $max_depth = null
140
+    ) {
141 141
         static::mustBeCountable($existing_row);
142 142
         static::mustBeCountable($conflict_row);
143 143
 
144 144
         foreach ($conflict_row as $column => $conflict_value) {
145 145
 
146 146
             // not existing in first array
147
-            if (!isset($existing_row[$column])) {
147
+            if ( ! isset($existing_row[$column])) {
148 148
                 $existing_row[$column] = $conflict_value;
149 149
                 continue;
150 150
             }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             }
178 178
             else {
179 179
                 // same resolution as array_merge_recursive
180
-                if (!is_array($existing_value)) {
180
+                if ( ! is_array($existing_value)) {
181 181
                     $existing_row[$column] = [$existing_value];
182 182
                 }
183 183
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
     public static function mergePreservingDistincts(
201 201
         $existing_row,
202 202
         $conflict_row
203
-    ){
203
+    ) {
204 204
         static::mustBeCountable($existing_row);
205 205
         static::mustBeCountable($conflict_row);
206 206
 
207 207
         $merge = static::mergeRecursiveCustom(
208 208
             $existing_row,
209 209
             $conflict_row,
210
-            function ($existing_value, $conflict_value, $column) {
210
+            function($existing_value, $conflict_value, $column) {
211 211
 
212 212
                 if ( ! $existing_value instanceof MergeBucket) {
213 213
                     $existing_value = MergeBucket::from()->push($existing_value);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      * @param  array|Countable   $row
237 237
      * @param  array             $options : 'excluded_columns'
238 238
      */
239
-    public static function cleanMergeDuplicates($row, array $options=[])
239
+    public static function cleanMergeDuplicates($row, array $options = [])
240 240
     {
241 241
         static::mustBeCountable($row);
242 242
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      * @see mergePreservingDistincts()
270 270
      * @see cleanMergeDuplicates()
271 271
      */
272
-    public static function cleanMergeBuckets($row, array $options=[])
272
+    public static function cleanMergeBuckets($row, array $options = [])
273 273
     {
274 274
         static::mustBeCountable($row);
275 275
 
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
                 $id = serialize($value);
311 311
             }
312 312
 
313
-            if (isset($ids[ $id ])) {
314
-                unset($array[ $key ]);
315
-                $ids[ $id ][] = $key;
313
+            if (isset($ids[$id])) {
314
+                unset($array[$key]);
315
+                $ids[$id][] = $key;
316 316
                 continue;
317 317
             }
318 318
 
319
-            $ids[ $id ] = [$key];
319
+            $ids[$id] = [$key];
320 320
         }
321 321
 
322 322
         return $array;
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         }
337 337
         else {
338 338
             throw new \InvalidArgumentException(
339
-                "keyExists() method missing on :\n". var_export($array, true)
339
+                "keyExists() method missing on :\n".var_export($array, true)
340 340
             );
341 341
         }
342 342
 
@@ -412,16 +412,16 @@  discard block
 block discarded – undo
412 412
             throw new \InvalidArgumentException(
413 413
                 "Different number of "
414 414
                 ." values and weights for weight mean calculation: \n"
415
-                .var_export($values,  true)."\n\n"
415
+                .var_export($values, true)."\n\n"
416 416
                 .var_export($weights, true)
417 417
             );
418 418
         }
419 419
 
420
-        if (!$values)
420
+        if ( ! $values)
421 421
             return null;
422 422
 
423
-        $weights_sum  = array_sum($weights);
424
-        if (!$weights_sum)
423
+        $weights_sum = array_sum($weights);
424
+        if ( ! $weights_sum)
425 425
             return 0;
426 426
 
427 427
         $weighted_sum = 0;
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
         );
471 471
 
472 472
         // The true location of the throw is still available through the backtrace
473
-        $trace_location  = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0];
474
-        $reflectionClass = new \ReflectionClass( get_class($exception) );
473
+        $trace_location  = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0];
474
+        $reflectionClass = new \ReflectionClass(get_class($exception));
475 475
 
476 476
         // file
477 477
         if (isset($trace_location['file'])) {
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
         );
509 509
 
510 510
         // The true location of the throw is still available through the backtrace
511
-        $trace_location  = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0];
512
-        $reflectionClass = new \ReflectionClass( get_class($exception) );
511
+        $trace_location  = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0];
512
+        $reflectionClass = new \ReflectionClass(get_class($exception));
513 513
 
514 514
         // file
515 515
         if (isset($trace_location['file'])) {
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
      *
550 550
      * @return string       The unique identifier of the group
551 551
      */
552
-    public static function generateGroupId($row, array $groups_definitions, array $options=[])
552
+    public static function generateGroupId($row, array $groups_definitions, array $options = [])
553 553
     {
554 554
         Arrays::mustBeCountable($row);
555 555
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
                              : ':'
559 559
                              ;
560 560
 
561
-        $groups_separator    = ! empty($options['groups_separator'])
561
+        $groups_separator = ! empty($options['groups_separator'])
562 562
                              ? $options['groups_separator']
563 563
                              : '-'
564 564
                              ;
@@ -572,32 +572,32 @@  discard block
 block discarded – undo
572 572
             }
573 573
 
574 574
             if (is_string($group_definition_value)) {
575
-                if (    (is_array($row)              && ! array_key_exists($group_definition_value, $row))
575
+                if ((is_array($row) && ! array_key_exists($group_definition_value, $row))
576 576
                     ||  ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value))
577 577
                 ) {
578 578
                     throw new UsageException(
579 579
                         'Unset column for group id generation: '
580 580
                         .var_export($group_definition_value, true)
581
-                        ."\n" . var_export($row, true)
581
+                        ."\n".var_export($row, true)
582 582
                     );
583 583
                 }
584 584
 
585 585
                 $part_name         .= $group_definition_value;
586
-                $group_result_value = $row[ $group_definition_value ];
586
+                $group_result_value = $row[$group_definition_value];
587 587
             }
588 588
             elseif (is_int($group_definition_value)) {
589
-                if (    (is_array($row)              && ! array_key_exists($group_definition_value, $row))
589
+                if ((is_array($row) && ! array_key_exists($group_definition_value, $row))
590 590
                     ||  ($row instanceof \ArrayAcces && ! $row->offsetExists($group_definition_value))
591 591
                 ) {
592 592
                     throw new UsageException(
593 593
                         'Unset column for group id generation: '
594 594
                         .var_export($group_definition_value, true)
595
-                        ."\n" . var_export($row, true)
595
+                        ."\n".var_export($row, true)
596 596
                     );
597 597
                 }
598 598
 
599
-                $part_name         .= $group_definition_value ? : '0';
600
-                $group_result_value = $row[ $group_definition_value ];
599
+                $part_name         .= $group_definition_value ?: '0';
600
+                $group_result_value = $row[$group_definition_value];
601 601
             }
602 602
             /* TODO check this is not just dead code * /
603 603
             elseif (is_callable($group_definition_value)) {
@@ -623,12 +623,12 @@  discard block
 block discarded – undo
623 623
                 throw new UsageException(
624 624
                     'Bad value provided for group id generation: '
625 625
                     .var_export($group_definition_value, true)
626
-                    ."\n" . var_export($row, true)
626
+                    ."\n".var_export($row, true)
627 627
                 );
628 628
             }
629 629
 
630
-            if (!is_null($part_name))
631
-                $group_parts[ $part_name ] = $group_result_value;
630
+            if ( ! is_null($part_name))
631
+                $group_parts[$part_name] = $group_result_value;
632 632
         }
633 633
 
634 634
         // sort the groups by names (without it the same group could have multiple ids)
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
             if (is_object($group_value)) {
641 641
                 $group_value = get_class($group_value)
642 642
                              . '_'
643
-                             . hash( 'crc32b', var_export($group_value, true) );
643
+                             . hash('crc32b', var_export($group_value, true));
644 644
             }
645 645
             elseif (is_array($group_value)) {
646
-                $group_value = 'array_' . hash( 'crc32b', var_export($group_value, true) );
646
+                $group_value = 'array_'.hash('crc32b', var_export($group_value, true));
647 647
             }
648 648
 
649
-            $out[] = $group_name . $key_value_separator . $group_value;
649
+            $out[] = $group_name.$key_value_separator.$group_value;
650 650
         }
651 651
 
652 652
         return implode($groups_separator, $out);
Please login to merge, or discard this patch.
src/Exceptions/UsageException.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,33 +18,33 @@
 block discarded – undo
18 18
     {
19 19
         parent::__construct(...func_get_args());
20 20
 
21
-        $this->rewindStackWhile( function($backtrace, $level) {
21
+        $this->rewindStackWhile(function($backtrace, $level) {
22 22
             // Finds the closest caller
23
-            return  isset($backtrace[ $level ]['class'])
24
-                &&  $backtrace[ $level ]['class'] == __CLASS__;
25
-        }, 0 );
23
+            return  isset($backtrace[$level]['class'])
24
+                &&  $backtrace[$level]['class'] == __CLASS__;
25
+        }, 0);
26 26
     }
27 27
 
28 28
     /**
29 29
      */
30 30
     public function setStackLocationHere()
31 31
     {
32
-        $this->rewindStackWhile( function($backtrace, $level) {
32
+        $this->rewindStackWhile(function($backtrace, $level) {
33 33
             // Finds the closest caller
34 34
             return $level < 2;
35
-        }, 4 );
35
+        }, 4);
36 36
 
37 37
         return $this;
38 38
     }
39 39
 
40 40
     /**
41 41
      */
42
-    protected function rewindStackWhile(callable $scope_checker, $stack_max_depth=20)
42
+    protected function rewindStackWhile(callable $scope_checker, $stack_max_depth = 20)
43 43
     {
44
-        $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $stack_max_depth);
44
+        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $stack_max_depth);
45 45
         $i         = 1;
46 46
         $caller    = $backtrace[$i];
47
-        while ( $scope_checker( $backtrace, $i ) ) {
47
+        while ($scope_checker($backtrace, $i)) {
48 48
             $i++;
49 49
             $caller = $backtrace[$i];
50 50
             // TODO remove the previous levels of the stack?
Please login to merge, or discard this patch.