@@ -105,8 +105,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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_compare = $description[2]; |
| 141 | 141 | } |
| 142 | 142 | else { |
@@ -155,7 +155,7 @@ discard block |
||
| 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_compare = count($rule->getOperands()); |
@@ -216,16 +216,16 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | else { |
| 218 | 218 | throw new \InvalidArgumentException( |
| 219 | - "Unhandled operator: " . $operator |
|
| 219 | + "Unhandled operator: ".$operator |
|
| 220 | 220 | ); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if (! empty($options['debug'])) { |
|
| 223 | + if ( ! empty($options['debug'])) { |
|
| 224 | 224 | var_dump( |
| 225 | - "$field, $operator, " . var_export($value, true) |
|
| 226 | - . ' || '. $value_to_compare . ' => ' . var_export($out, true) |
|
| 227 | - . "\n" . get_class($rule) |
|
| 228 | - . "\n" . var_export($options, true) |
|
| 225 | + "$field, $operator, ".var_export($value, true) |
|
| 226 | + . ' || '.$value_to_compare.' => '.var_export($out, true) |
|
| 227 | + . "\n".get_class($rule) |
|
| 228 | + . "\n".var_export($options, true) |
|
| 229 | 229 | ); |
| 230 | 230 | // $rule->dump(); |
| 231 | 231 | } |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | * @param array|AbstractRule $ruleTree_to_filter |
| 241 | 241 | * @param array $options leaves_only | debug |
| 242 | 242 | */ |
| 243 | - public function apply(LogicalFilter $filter, $ruleTree_to_filter, $options=[]) |
|
| 243 | + public function apply(LogicalFilter $filter, $ruleTree_to_filter, $options = []) |
|
| 244 | 244 | { |
| 245 | - if (! $ruleTree_to_filter) { |
|
| 245 | + if ( ! $ruleTree_to_filter) { |
|
| 246 | 246 | return $ruleTree_to_filter; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -250,10 +250,10 @@ discard block |
||
| 250 | 250 | $ruleTree_to_filter = [$ruleTree_to_filter]; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if (! is_array($ruleTree_to_filter)) { |
|
| 253 | + if ( ! is_array($ruleTree_to_filter)) { |
|
| 254 | 254 | throw new \InvalidArgumentException( |
| 255 | 255 | "\$ruleTree_to_filter must be an array or an AbstractRule " |
| 256 | - ."instead of: " . var_export($ruleTree_to_filter, true) |
|
| 256 | + ."instead of: ".var_export($ruleTree_to_filter, true) |
|
| 257 | 257 | ); |
| 258 | 258 | } |
| 259 | 259 | |