Test Failed
Push — master ( 1c1a74...bfeb2d )
by Jean
05:17
created
src/LogicalFilter.php 2 patches
Doc Comments   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
      *
536 536
      * This helpes to ease the result of simplify()
537 537
      *
538
-     * @return OrRule
538
+     * @return LogicalFilter
539 539
      */
540 540
     public function addMinimalCase()
541 541
     {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      *
591 591
      * @param $debug Provides a source oriented dump.
592 592
      *
593
-     * @return array A description of the rules.
593
+     * @return string A description of the rules.
594 594
      */
595 595
     public function toString(array $options=[])
596 596
     {
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
      * @param  array|callable Associative array of renamings or callable
669 669
      *                        that would rename the fields.
670 670
      *
671
-     * @return string $this
671
+     * @return LogicalFilter $this
672 672
      */
673 673
     public function removeRules($filter)
674 674
     {
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
      * @param  array|callable Associative array of renamings or callable
712 712
      *                        that would rename the fields.
713 713
      *
714
-     * @return array The rules matching the filter
715
-     * @return array $options debug | leaves_only | clean_empty_branches
714
+     * @return LogicalFilter The rules matching the filter
715
+     * @return LogicalFilter $options debug | leaves_only | clean_empty_branches
716 716
      *
717 717
      *
718 718
      * @todo Merge with rules
@@ -823,6 +823,7 @@  discard block
 block discarded – undo
823 823
      * @param  array|LogicalFilter
824 824
      * @param  array|callable Associative array of renamings or callable
825 825
      *                        that would rename the fields.
826
+     * @param \Closure $options
826 827
      *
827 828
      * @return array          The rules matching the filter
828 829
      */
@@ -887,7 +888,6 @@  discard block
 block discarded – undo
887 888
      * Retrieves the minimum possibility and the maximum possibility for
888 889
      * the given field.
889 890
      *
890
-     * @param  array|LogicalFilter|AbstractRule $filter
891 891
      * @return array The bounds of the range and a nullable
892 892
      */
893 893
     public function getRanges($ruleFilter=null)
@@ -1005,7 +1005,6 @@  discard block
 block discarded – undo
1005 1005
     }
1006 1006
 
1007 1007
     /**
1008
-     * @param bool  $exit=false
1009 1008
      * @param array $options    + callstack_depth=2 The level of the caller to dump
1010 1009
      *                          + mode='string' in 'export' | 'dump' | 'string'
1011 1010
      *
@@ -1100,10 +1099,9 @@  discard block
 block discarded – undo
1100 1099
      * Applies the current instance to a value (and its index optionnally).
1101 1100
      *
1102 1101
      * @param  mixed                  $value_to_check
1103
-     * @param  scalar                 $index
1104 1102
      * @param  Filterer|callable|null $filterer
1105 1103
      *
1106
-     * @return AbstractRule|false|true + False if the filter doesn't validates
1104
+     * @return boolean + False if the filter doesn't validates
1107 1105
      *                                 + Null if the target has no sens (operation filtered by field for example)
1108 1106
      *                                 + A rule tree containing the first matching case if there is one.
1109 1107
      */
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @see self::addRules
53 53
      */
54
-    public function __construct($rules=[], Filterer $default_filterer=null, array $options=[])
54
+    public function __construct($rules = [], Filterer $default_filterer = null, array $options = [])
55 55
     {
56 56
         if ($rules instanceof AbstractRule) {
57 57
             $rules = $rules->copy();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         }
73 73
 
74 74
         if ($rules) {
75
-            $this->and_( $rules );
75
+            $this->and_($rules);
76 76
         }
77 77
     }
78 78
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function getDefaultFilterer()
82 82
     {
83
-        if (! $this->default_filterer) {
83
+        if ( ! $this->default_filterer) {
84 84
             $this->default_filterer = new PhpFilterer();
85 85
         }
86 86
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             }
162 162
         }
163 163
 
164
-        if (   3 == count($rules_description)
164
+        if (3 == count($rules_description)
165 165
             && is_string($rules_description[0])
166 166
             && is_string($rules_description[1])
167 167
         ) {
@@ -177,30 +177,30 @@  discard block
 block discarded – undo
177 177
         }
178 178
         elseif (count($rules_description) == count(array_filter($rules_description, function($arg) {
179 179
             return $arg instanceof LogicalFilter;
180
-        })) ) {
180
+        }))) {
181 181
             // Already instanciated rules
182 182
             foreach ($rules_description as $i => $filter) {
183 183
                 $rules = $filter->getRules();
184 184
                 if (null !== $rules) {
185
-                    $this->addRule( $rules, $operation);
185
+                    $this->addRule($rules, $operation);
186 186
                 }
187 187
             }
188 188
         }
189 189
         elseif (count($rules_description) == count(array_filter($rules_description, function($arg) {
190 190
             return $arg instanceof AbstractRule;
191
-        })) ) {
191
+        }))) {
192 192
             // Already instanciated rules
193 193
             foreach ($rules_description as $i => $new_rule) {
194
-                $this->addRule( $new_rule, $operation);
194
+                $this->addRule($new_rule, $operation);
195 195
             }
196 196
         }
197 197
         elseif (1 == count($rules_description) && is_array($rules_description[0])) {
198 198
             if (count($rules_description[0]) == count(array_filter($rules_description[0], function($arg) {
199 199
                 return $arg instanceof AbstractRule;
200
-            })) ) {
200
+            }))) {
201 201
                 // Case of $filter->or_([AbstractRule, AbstractRule, AbstractRule, ...])
202 202
                 foreach ($rules_description[0] as $i => $new_rule) {
203
-                    $this->addRule( $new_rule, $operation );
203
+                    $this->addRule($new_rule, $operation);
204 204
                 }
205 205
             }
206 206
             else {
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
      *
233 233
      * @return $this
234 234
      */
235
-    protected function addRule( AbstractRule $rule, $operation=AndRule::operator )
235
+    protected function addRule(AbstractRule $rule, $operation = AndRule::operator)
236 236
     {
237
-        if ($this->rules && in_array( get_class($this->rules), [AndRule::class, OrRule::class])
238
-            && ! $this->rules->getOperands() ) {
237
+        if ($this->rules && in_array(get_class($this->rules), [AndRule::class, OrRule::class])
238
+            && ! $this->rules->getOperands()) {
239 239
             throw new \LogicException(
240 240
                  "You are trying to add rules to a LogicalFilter which had "
241 241
                 ."only contradictory rules that have already been simplified: "
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         array $rules_composition,
285 285
         AbstractOperationRule $recursion_position
286 286
     ) {
287
-        if ( ! array_filter($rules_composition, function ($rule_composition_part) {
287
+        if ( ! array_filter($rules_composition, function($rule_composition_part) {
288 288
             return is_string($rule_composition_part);
289 289
         })) {
290 290
             // at least one operator is required for operation rules
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
                 .var_export($rules_composition, true)
294 294
             );
295 295
         }
296
-        elseif ( 3 == count($rules_composition)
297
-            && ! in_array( AndRule::operator, $rules_composition, true )
298
-            && ! in_array( OrRule::operator, $rules_composition, true )
299
-            && ! in_array( NotRule::operator, $rules_composition, true )
300
-            && ! in_array( AbstractRule::findSymbolicOperator( AndRule::operator ), $rules_composition, true )
301
-            && ! in_array( AbstractRule::findSymbolicOperator( OrRule::operator ), $rules_composition, true )
302
-            && ! in_array( AbstractRule::findSymbolicOperator( NotRule::operator ), $rules_composition, true )
296
+        elseif (3 == count($rules_composition)
297
+            && ! in_array(AndRule::operator, $rules_composition, true)
298
+            && ! in_array(OrRule::operator, $rules_composition, true)
299
+            && ! in_array(NotRule::operator, $rules_composition, true)
300
+            && ! in_array(AbstractRule::findSymbolicOperator(AndRule::operator), $rules_composition, true)
301
+            && ! in_array(AbstractRule::findSymbolicOperator(OrRule::operator), $rules_composition, true)
302
+            && ! in_array(AbstractRule::findSymbolicOperator(NotRule::operator), $rules_composition, true)
303 303
         ) {
304 304
             // atomic or composit rules
305 305
             $operand_left  = $rules_composition[0];
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
             $rule = AbstractRule::generateSimpleRule(
310 310
                 $operand_left, $operation, $operand_right, $this->getOptions()
311 311
             );
312
-            $recursion_position->addOperand( $rule );
312
+            $recursion_position->addOperand($rule);
313 313
         }
314 314
         else {
315 315
             // operations
316
-            if (   NotRule::operator == $rules_composition[0]
317
-                || $rules_composition[0] == AbstractRule::findSymbolicOperator( NotRule::operator ) ) {
316
+            if (NotRule::operator == $rules_composition[0]
317
+                || $rules_composition[0] == AbstractRule::findSymbolicOperator(NotRule::operator)) {
318 318
                 $rule = new NotRule();
319 319
             }
320
-            elseif (in_array( AndRule::operator, $rules_composition )
321
-                || in_array( AbstractRule::findSymbolicOperator( AndRule::operator ), $rules_composition )) {
320
+            elseif (in_array(AndRule::operator, $rules_composition)
321
+                || in_array(AbstractRule::findSymbolicOperator(AndRule::operator), $rules_composition)) {
322 322
                 $rule = new AndRule();
323 323
             }
324
-            elseif (in_array( OrRule::operator, $rules_composition )
325
-                || in_array( AbstractRule::findSymbolicOperator( OrRule::operator ), $rules_composition ) ) {
324
+            elseif (in_array(OrRule::operator, $rules_composition)
325
+                || in_array(AbstractRule::findSymbolicOperator(OrRule::operator), $rules_composition)) {
326 326
                 $rule = new OrRule();
327 327
             }
328 328
             else {
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 
337 337
             $operands_descriptions = array_filter(
338 338
                 $rules_composition,
339
-                function ($operand) use ($operator) {
340
-                    return ! in_array($operand, [$operator, AbstractRule::findSymbolicOperator( $operator )]);
339
+                function($operand) use ($operator) {
340
+                    return ! in_array($operand, [$operator, AbstractRule::findSymbolicOperator($operator)]);
341 341
                 }
342 342
             );
343 343
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
             foreach ($operands_descriptions as $i => $operands_description) {
354 354
                 if (false === $operands_description) {
355
-                    $operands_descriptions[ $i ] = ['and']; // FalseRule hack
355
+                    $operands_descriptions[$i] = ['and']; // FalseRule hack
356 356
                 }
357 357
                 elseif (null === $operands_description || true === $operands_description) {
358 358
                     $operands_description = ['and'];
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                         );
364 364
                     }
365 365
 
366
-                    unset($operands_descriptions[ $i ]);
366
+                    unset($operands_descriptions[$i]);
367 367
                 }
368 368
             }
369 369
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                 throw new \InvalidArgumentException(
382 382
                     "Mixing different operations in the same rule level not implemented: \n["
383 383
                     . implode(', ', $remaining_operations)."]\n"
384
-                    . 'in ' . var_export($rules_composition, true)
384
+                    . 'in '.var_export($rules_composition, true)
385 385
                 );
386 386
             }
387 387
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                 }
408 408
             }
409 409
 
410
-            $recursion_position->addOperand( $rule );
410
+            $recursion_position->addOperand($rule);
411 411
         }
412 412
 
413 413
         return $this;
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
      */
437 437
     public function and_()
438 438
     {
439
-        $this->addRules( AndRule::operator, func_get_args());
439
+        $this->addRules(AndRule::operator, func_get_args());
440 440
         return $this;
441 441
     }
442 442
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
      */
465 465
     public function or_()
466 466
     {
467
-        $this->addRules( OrRule::operator, func_get_args());
467
+        $this->addRules(OrRule::operator, func_get_args());
468 468
         return $this;
469 469
     }
470 470
 
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
      * @param  array $options stop_after | stop_before |
512 512
      * @return $this
513 513
      */
514
-    public function simplify($options=[])
514
+    public function simplify($options = [])
515 515
     {
516 516
         if ($this->rules) {
517 517
             // AndRule added to make all Operation methods available
518 518
             $this->rules = (new AndRule([$this->rules]))
519
-                ->simplify( $options )
519
+                ->simplify($options)
520 520
                 // ->dump(true, false)
521 521
                 ;
522 522
         }
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
      *
560 560
      * @return bool
561 561
      */
562
-    public function hasSolution($save_simplification=true)
562
+    public function hasSolution($save_simplification = true)
563 563
     {
564
-        if (! $this->rules) {
564
+        if ( ! $this->rules) {
565 565
             return true;
566 566
         }
567 567
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      *
581 581
      * @return array A description of the rules.
582 582
      */
583
-    public function toArray(array $options=[])
583
+    public function toArray(array $options = [])
584 584
     {
585 585
         return $this->rules ? $this->rules->toArray($options) : $this->rules;
586 586
     }
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      *
593 593
      * @return array A description of the rules.
594 594
      */
595
-    public function toString(array $options=[])
595
+    public function toString(array $options = [])
596 596
     {
597 597
         return $this->rules ? $this->rules->toString($options) : $this->rules;
598 598
     }
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
      * @param  mixed $row
631 631
      * @return bool
632 632
      */
633
-    public function __invoke($row, $key=null)
633
+    public function __invoke($row, $key = null)
634 634
     {
635 635
         return $this->validates($row, $key);
636 636
     }
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
             [
681 681
                 Filterer::on_row_matches => function($rule, $key, &$rows, $matching_case) use (&$cache_flush_required) {
682 682
                     // $rule->dump();
683
-                    unset( $rows[$key] );
684
-                    if ( ! $rows ) {
683
+                    unset($rows[$key]);
684
+                    if ( ! $rows) {
685 685
                         throw new \Exception(
686 686
                              "Removing the only rule $rule from the filter $this "
687 687
                             ."produces a case which has no possible solution due to missing "
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
      *
718 718
      * @todo Merge with rules
719 719
      */
720
-    public function keepLeafRulesMatching($filter=[], array $options=[])
720
+    public function keepLeafRulesMatching($filter = [], array $options = [])
721 721
     {
722 722
         $clean_empty_branches = ! isset($options['clean_empty_branches']) || $options['clean_empty_branches'];
723 723
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
         // ->dump()
726 726
         ;
727 727
 
728
-        $options[ Filterer::leaves_only ] = true;
728
+        $options[Filterer::leaves_only] = true;
729 729
 
730 730
         $this->rules = (new RuleFilterer)->apply($filter, $this->rules, $options);
731 731
         // $this->rules->dump(true);
@@ -765,13 +765,13 @@  discard block
 block discarded – undo
765 765
      *
766 766
      * @todo Merge with rules
767 767
      */
768
-    public function listLeafRulesMatching($filter=[])
768
+    public function listLeafRulesMatching($filter = [])
769 769
     {
770 770
         $filter = (new LogicalFilter($filter, new RuleFilterer))
771 771
         // ->dump()
772 772
         ;
773 773
 
774
-        if (! $this->rules) {
774
+        if ( ! $this->rules) {
775 775
             return [];
776 776
         }
777 777
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                     $key,
786 786
                     array $siblings
787 787
                 ) use (&$out) {
788
-                    if (   ! $matching_rule instanceof AndRule
788
+                    if ( ! $matching_rule instanceof AndRule
789 789
                         && ! $matching_rule instanceof OrRule
790 790
                         && ! $matching_rule instanceof NotRule
791 791
                     ) {
@@ -826,13 +826,13 @@  discard block
 block discarded – undo
826 826
      *
827 827
      * @return array          The rules matching the filter
828 828
      */
829
-    public function onEachRule($filter=[], $options)
829
+    public function onEachRule($filter = [], $options)
830 830
     {
831 831
         $filter = (new LogicalFilter($filter, new RuleFilterer))
832 832
         // ->dump()
833 833
         ;
834 834
 
835
-        if (! $this->rules) {
835
+        if ( ! $this->rules) {
836 836
             return [];
837 837
         }
838 838
 
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
     {
866 866
         $this->simplify()->addMinimalCase();
867 867
 
868
-        if (! $this->rules) {
868
+        if ( ! $this->rules) {
869 869
             return $this;
870 870
         }
871 871
 
@@ -890,11 +890,11 @@  discard block
 block discarded – undo
890 890
      * @param  array|LogicalFilter|AbstractRule $filter
891 891
      * @return array The bounds of the range and a nullable
892 892
      */
893
-    public function getRanges($ruleFilter=null)
893
+    public function getRanges($ruleFilter = null)
894 894
     {
895 895
         $ranges = [];
896 896
 
897
-        $this->onEachCase(function (AndRule $and_rule) use (&$ranges, $ruleFilter) {
897
+        $this->onEachCase(function(AndRule $and_rule) use (&$ranges, $ruleFilter) {
898 898
             (new self($and_rule))->onEachRule(
899 899
                 ['and',
900 900
                     $ruleFilter,
@@ -903,12 +903,12 @@  discard block
 block discarded – undo
903 903
                         '><', '><=', '=><=', '=><',
904 904
                     ]],
905 905
                 ],
906
-                function ($rule) use (&$ranges) {
906
+                function($rule) use (&$ranges) {
907 907
 
908 908
                     $field = $rule->getField();
909 909
 
910
-                    $range = isset($ranges[ $field ])
911
-                           ? $ranges[ $field ]
910
+                    $range = isset($ranges[$field])
911
+                           ? $ranges[$field]
912 912
                            : ['min' => [], 'max' => [], 'nullable' => false];
913 913
 
914 914
                     if ($rule::operator == '=') {
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
                         );
937 937
                     }
938 938
 
939
-                    $ranges[ $field ] = $range;
939
+                    $ranges[$field] = $range;
940 940
                 }
941 941
             );
942 942
         });
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
      */
959 959
     public function getFieldRange($field)
960 960
     {
961
-        return reset( $this->getRanges(['field', '=', $field]) );
961
+        return reset($this->getRanges(['field', '=', $field]));
962 962
     }
963 963
 
964 964
     /**
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
      *
988 988
      * @return LogicalFilter
989 989
      */
990
-    public function saveAs( &$variable)
990
+    public function saveAs(&$variable)
991 991
     {
992 992
         return $variable = $this;
993 993
     }
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
      *
999 999
      * @return LogicalFilter
1000 1000
      */
1001
-    public function saveCopyAs( &$copied_variable)
1001
+    public function saveCopyAs(&$copied_variable)
1002 1002
     {
1003 1003
         $copied_variable = $this->copy();
1004 1004
         return $this;
@@ -1011,15 +1011,15 @@  discard block
 block discarded – undo
1011 1011
      *
1012 1012
      * @return $this
1013 1013
      */
1014
-    public function dump($exit=false, array $options=[])
1014
+    public function dump($exit = false, array $options = [])
1015 1015
     {
1016 1016
         $default_options = [
1017 1017
             'callstack_depth' => 3,
1018 1018
             'mode'            => 'string',
1019 1019
         ];
1020 1020
         foreach ($default_options as $default_option => &$default_value) {
1021
-            if ( ! isset($options[ $default_option ])) {
1022
-                $options[ $default_option ] = $default_value;
1021
+            if ( ! isset($options[$default_option])) {
1022
+                $options[$default_option] = $default_value;
1023 1023
             }
1024 1024
         }
1025 1025
         extract($options);
@@ -1030,24 +1030,24 @@  discard block
 block discarded – undo
1030 1030
         else {
1031 1031
             // TODO dump a TrueRule
1032 1032
             $bt     = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $callstack_depth);
1033
-            $caller = $bt[ $callstack_depth - 2 ];
1033
+            $caller = $bt[$callstack_depth - 2];
1034 1034
 
1035 1035
             // get line and file from the previous level of the caller
1036 1036
             // TODO go deeper if this case exist?
1037
-            if (! isset($caller['file'])) {
1038
-                $caller['file'] = $bt[ $callstack_depth - 3 ]['file'];
1037
+            if ( ! isset($caller['file'])) {
1038
+                $caller['file'] = $bt[$callstack_depth - 3]['file'];
1039 1039
             }
1040 1040
 
1041
-            if (! isset($caller['line'])) {
1042
-                $caller['line'] = $bt[ $callstack_depth - 3 ]['line'];
1041
+            if ( ! isset($caller['line'])) {
1042
+                $caller['line'] = $bt[$callstack_depth - 3]['line'];
1043 1043
             }
1044 1044
 
1045 1045
             try {
1046
-                echo "\n" . $caller['file'] . ':' . $caller['line'] . "\n";
1046
+                echo "\n".$caller['file'].':'.$caller['line']."\n";
1047 1047
                 var_export($this->toArray($options));
1048 1048
             }
1049 1049
             catch (\Exception $e) {
1050
-                echo "\nError while dumping: " . $e->getMessage() . "\n";
1050
+                echo "\nError while dumping: ".$e->getMessage()."\n";
1051 1051
                 var_export($caller);
1052 1052
                 echo "\n\n";
1053 1053
                 var_export($bt);
@@ -1072,15 +1072,15 @@  discard block
 block discarded – undo
1072 1072
      *
1073 1073
      * @return mixed The filtered data
1074 1074
      */
1075
-    public function applyOn($data_to_filter, $action_on_matches=null, $filterer=null)
1075
+    public function applyOn($data_to_filter, $action_on_matches = null, $filterer = null)
1076 1076
     {
1077
-        if (! $filterer) {
1077
+        if ( ! $filterer) {
1078 1078
             $filterer = $this->getDefaultFilterer();
1079 1079
         }
1080 1080
         elseif (is_callable($filterer)) {
1081 1081
             $filterer = new CustomizableFilterer($filterer);
1082 1082
         }
1083
-        elseif (! $filterer instanceof Filterer) {
1083
+        elseif ( ! $filterer instanceof Filterer) {
1084 1084
             throw new \InvalidArgumentException(
1085 1085
                  "The given \$filterer must be null or a callable or a instance "
1086 1086
                 ."of Filterer instead of: ".var_export($filterer, true)
@@ -1088,8 +1088,8 @@  discard block
 block discarded – undo
1088 1088
         }
1089 1089
 
1090 1090
         if ($data_to_filter instanceof LogicalFilter) {
1091
-            $filtered_rules = $filterer->apply( $this, $data_to_filter->getRules() );
1092
-            return $data_to_filter->flushRules()->addRule( $filtered_rules );
1091
+            $filtered_rules = $filterer->apply($this, $data_to_filter->getRules());
1092
+            return $data_to_filter->flushRules()->addRule($filtered_rules);
1093 1093
         }
1094 1094
         else {
1095 1095
             return $filterer->apply($this, $data_to_filter);
@@ -1107,15 +1107,15 @@  discard block
 block discarded – undo
1107 1107
      *                                 + Null if the target has no sens (operation filtered by field for example)
1108 1108
      *                                 + A rule tree containing the first matching case if there is one.
1109 1109
      */
1110
-    public function validates($value_to_check, $key_to_check=null, $filterer=null)
1110
+    public function validates($value_to_check, $key_to_check = null, $filterer = null)
1111 1111
     {
1112
-        if (! $filterer) {
1112
+        if ( ! $filterer) {
1113 1113
             $filterer = $this->getDefaultFilterer();
1114 1114
         }
1115 1115
         elseif (is_callable($filterer)) {
1116 1116
             $filterer = new CustomizableFilterer($filterer);
1117 1117
         }
1118
-        elseif (! $filterer instanceof Filterer) {
1118
+        elseif ( ! $filterer instanceof Filterer) {
1119 1119
             throw new \InvalidArgumentException(
1120 1120
                  "The given \$filterer must be null or a callable or a instance "
1121 1121
                 ."of Filterer instead of: ".var_export($filterer, true)
Please login to merge, or discard this patch.