Test Failed
Push — master ( fdab26...175b46 )
by Jean
04:16
created
src/Filterer/PhpFilterer.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
26 26
 {
27 27
     /**
28 28
      */
29
-    public function validateRule ($field, $operator, $value, $row, array $path, $all_operands, $options)
29
+    public function validateRule($field, $operator, $value, $row, array $path, $all_operands, $options)
30 30
     {
31 31
         if ($field instanceof FilteredValue) {
32
-            $value_to_validate = $field( $row );
32
+            $value_to_validate = $field($row);
33 33
         }
34 34
         elseif ($field instanceof FilteredKey) {
35
-            $value_to_validate = $field( array_pop($path) );
35
+            $value_to_validate = $field(array_pop($path));
36 36
         }
37
-        elseif (! isset($row[(string) $field])) {
37
+        elseif ( ! isset($row[(string) $field])) {
38 38
             $value_to_validate = null;
39 39
         }
40 40
         else {
41
-            $value_to_validate = $row[ $field ];
41
+            $value_to_validate = $row[$field];
42 42
         }
43 43
 
44 44
         if (EqualRule::operator === $operator) {
45
-            if (! isset($value_to_validate)) {
45
+            if ( ! isset($value_to_validate)) {
46 46
                 // ['field', '=', null] <=> isset($row['field'])
47 47
                 // [row, '=', null] <=> $row !== null
48 48
                 $result = null === $value;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             );
60 60
         }
61 61
         elseif (BelowRule::operator === $operator) {
62
-            if (! isset($value_to_validate)) {
62
+            if ( ! isset($value_to_validate)) {
63 63
                 $result = false;
64 64
             }
65 65
             else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             }
68 68
         }
69 69
         elseif (AboveRule::operator === $operator) {
70
-            if (! isset($value_to_validate)) {
70
+            if ( ! isset($value_to_validate)) {
71 71
                 $result = false;
72 72
             }
73 73
             else {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             );
90 90
         }
91 91
         elseif (AboveOrEqualRule::operator === $operator) {
92
-            if (! isset($value_to_validate)) {
92
+            if ( ! isset($value_to_validate)) {
93 93
                 $result = false;
94 94
             }
95 95
             else {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             }
98 98
         }
99 99
         elseif (BelowOrEqualRule::operator === $operator) {
100
-            if (! isset($value_to_validate)) {
100
+            if ( ! isset($value_to_validate)) {
101 101
                 $result = false;
102 102
             }
103 103
             else {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             }
106 106
         }
107 107
         elseif (RegexpRule::operator === $operator) {
108
-            if (! isset($value_to_validate)) {
108
+            if ( ! isset($value_to_validate)) {
109 109
                 $result = false;
110 110
             }
111 111
             else {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         }
130 130
         else {
131 131
             throw new \InvalidArgumentException(
132
-                "Unhandled operator: " . $operator
132
+                "Unhandled operator: ".$operator
133 133
             );
134 134
         }
135 135
 
Please login to merge, or discard this patch.
src/Filterer/RuleFilterer.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -230,9 +230,9 @@
 block discarded – undo
230 230
         if (! empty($options['debug'])) {
231 231
             var_dump(
232 232
                 "$field, $operator, " . var_export($value, true)
233
-                 . ' ||  '. $value_to_validate . ' => ' . var_export($out, true)
234
-                 . "\n" . get_class($rule)
235
-                 . "\n" . var_export($options, true)
233
+                    . ' ||  '. $value_to_validate . ' => ' . var_export($out, true)
234
+                    . "\n" . get_class($rule)
235
+                    . "\n" . var_export($options, true)
236 236
             );
237 237
             // $rule->dump();
238 238
         }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function validateRule($field, $operator, $value, $rule, array $path, $all_operands, $options)
107 107
     {
108
-        if (   ! empty($options[ Filterer::leaves_only ])
109
-            && in_array( get_class($rule), [OrRule::class, AndRule::class, NotRule::class] )
108
+        if ( ! empty($options[Filterer::leaves_only])
109
+            && in_array(get_class($rule), [OrRule::class, AndRule::class, NotRule::class])
110 110
         ) {
111 111
             // Rules concerning the "field of a rule" have nbo sens on
112 112
             // operation rules
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         }
115 115
 
116 116
         if (self::field === $field) {
117
-            if (! method_exists($rule, 'getField')) {
117
+            if ( ! method_exists($rule, 'getField')) {
118 118
                 // if (in_array( get_class($rule), [AndRule::class, OrRule::class]))
119 119
                 return null; // The filter cannot be applied to this rule
120 120
             }
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
         elseif (self::value === $field) {
135 135
             $description = $rule->toArray();
136 136
 
137
-            if (    3 === count($description)
137
+            if (3 === count($description)
138 138
                 && is_string($description[0])
139
-                && is_string($description[1]) ) {
139
+                && is_string($description[1])) {
140 140
                 $value_to_validate = $description[2];
141 141
             }
142 142
             else {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             throw new \InvalidArgumentException('Path rule suppport not implemented');
156 156
         }
157 157
         elseif (self::children === $field) {
158
-            if (! method_exists($rule, 'getOperands')) {
158
+            if ( ! method_exists($rule, 'getOperands')) {
159 159
                 return null; // The filter cannot be applied to this rule
160 160
             }
161 161
             $value_to_validate = count($rule->getOperands());
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
         }
224 224
         else {
225 225
             throw new \InvalidArgumentException(
226
-                "Unhandled operator: " . $operator
226
+                "Unhandled operator: ".$operator
227 227
             );
228 228
         }
229 229
 
230
-        if (! empty($options['debug'])) {
230
+        if ( ! empty($options['debug'])) {
231 231
             var_dump(
232
-                "$field, $operator, " . var_export($value, true)
233
-                 . ' ||  '. $value_to_validate . ' => ' . var_export($out, true)
234
-                 . "\n" . get_class($rule)
235
-                 . "\n" . var_export($options, true)
232
+                "$field, $operator, ".var_export($value, true)
233
+                 . ' ||  '.$value_to_validate.' => '.var_export($out, true)
234
+                 . "\n".get_class($rule)
235
+                 . "\n".var_export($options, true)
236 236
             );
237 237
             // $rule->dump();
238 238
         }
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
      * @param array|AbstractRule $ruleTree_to_filter
248 248
      * @param array              $options leaves_only | debug
249 249
      */
250
-    public function apply(LogicalFilter $filter, $ruleTree_to_filter, $options=[])
250
+    public function apply(LogicalFilter $filter, $ruleTree_to_filter, $options = [])
251 251
     {
252
-        if (! $ruleTree_to_filter) {
252
+        if ( ! $ruleTree_to_filter) {
253 253
             return $ruleTree_to_filter;
254 254
         }
255 255
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
             $ruleTree_to_filter = [$ruleTree_to_filter];
258 258
         }
259 259
 
260
-        if (! is_array($ruleTree_to_filter)) {
260
+        if ( ! is_array($ruleTree_to_filter)) {
261 261
             throw new \InvalidArgumentException(
262 262
                 "\$ruleTree_to_filter must be an array or an AbstractRule "
263
-                ."instead of: " . var_export($ruleTree_to_filter, true)
263
+                ."instead of: ".var_export($ruleTree_to_filter, true)
264 264
             );
265 265
         }
266 266
 
Please login to merge, or discard this patch.