@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ( $this->rules && in_array( get_class($this->rules), [AndRule::class, OrRule::class] ) |
| 232 | 232 | && !$this->rules->getOperands() ) { |
| 233 | 233 | throw new \LogicException( |
| 234 | - "You are trying to add rules to a LogicalFilter which had " |
|
| 234 | + "You are trying to add rules to a LogicalFilter which had " |
|
| 235 | 235 | ."only contradictory rules that have already been simplified: " |
| 236 | 236 | .$this->rules |
| 237 | 237 | ); |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | unset( $rows[$key] ); |
| 653 | 653 | if ( ! $rows ) { |
| 654 | 654 | throw new \Exception( |
| 655 | - "Removing the only rule $rule from the filter $this" |
|
| 655 | + "Removing the only rule $rule from the filter $this" |
|
| 656 | 656 | ."produces a case which has no possible solution due to missing " |
| 657 | 657 | ."implementation of TrueRule.\n" |
| 658 | 658 | ."Please see: https://github.com/jclaveau/php-logical-filter/issues/59" |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | } |
| 940 | 940 | elseif (!$filterer instanceof Filterer) { |
| 941 | 941 | throw new \InvalidArgumentException( |
| 942 | - "The given \$filterer must be null or a callable or a instance " |
|
| 942 | + "The given \$filterer must be null or a callable or a instance " |
|
| 943 | 943 | ."of Filterer instead of: ".var_export($filterer, true) |
| 944 | 944 | ); |
| 945 | 945 | } |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | } |
| 975 | 975 | elseif (!$filterer instanceof Filterer) { |
| 976 | 976 | throw new \InvalidArgumentException( |
| 977 | - "The given \$filterer must be null or a callable or a instance " |
|
| 977 | + "The given \$filterer must be null or a callable or a instance " |
|
| 978 | 978 | ."of Filterer instead of: ".var_export($filterer, true) |
| 979 | 979 | ); |
| 980 | 980 | } |
@@ -51,12 +51,12 @@ discard block |
||
| 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(); |
| 58 | 58 | } |
| 59 | - elseif ( ! is_null($rules) && ! is_array($rules)) { |
|
| 59 | + elseif (!is_null($rules) && !is_array($rules)) { |
|
| 60 | 60 | throw new \InvalidArgumentException( |
| 61 | 61 | "\$rules must be a rules description or an AbstractRule instead of" |
| 62 | 62 | .var_export($rules, true) |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->options = $options; |
| 71 | 71 | |
| 72 | 72 | if ($rules) |
| 73 | - $this->and_( $rules ); |
|
| 73 | + $this->and_($rules); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param array $rules_description Rules description |
| 133 | 133 | * @return LogicalFilter $this |
| 134 | 134 | */ |
| 135 | - protected function addRules( $operation, array $rules_description ) |
|
| 135 | + protected function addRules($operation, array $rules_description) |
|
| 136 | 136 | { |
| 137 | 137 | if ($rules_description == [null]) { |
| 138 | 138 | // TODO this is due to the bad design of using "Null" instead of |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if ( count($rules_description) == 3 |
|
| 158 | + if (count($rules_description) == 3 |
|
| 159 | 159 | && is_string($rules_description[0]) |
| 160 | 160 | && is_string($rules_description[1]) |
| 161 | 161 | ) { |
@@ -171,30 +171,30 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | elseif (count($rules_description) == count(array_filter($rules_description, function($arg) { |
| 173 | 173 | return $arg instanceof LogicalFilter; |
| 174 | - })) ) { |
|
| 174 | + }))) { |
|
| 175 | 175 | // Already instanciated rules |
| 176 | 176 | foreach ($rules_description as $i => $filter) { |
| 177 | 177 | $rules = $filter->getRules(); |
| 178 | 178 | if ($rules !== null) |
| 179 | - $this->addRule( $rules, $operation); |
|
| 179 | + $this->addRule($rules, $operation); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | elseif (count($rules_description) == count(array_filter($rules_description, function($arg) { |
| 183 | 183 | return $arg instanceof AbstractRule; |
| 184 | - })) ) { |
|
| 184 | + }))) { |
|
| 185 | 185 | // Already instanciated rules |
| 186 | 186 | foreach ($rules_description as $i => $new_rule) { |
| 187 | - $this->addRule( $new_rule, $operation); |
|
| 187 | + $this->addRule($new_rule, $operation); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | elseif (count($rules_description) == 1 && is_array($rules_description[0])) { |
| 191 | 191 | |
| 192 | 192 | if (count($rules_description[0]) == count(array_filter($rules_description[0], function($arg) { |
| 193 | 193 | return $arg instanceof AbstractRule; |
| 194 | - })) ) { |
|
| 194 | + }))) { |
|
| 195 | 195 | // Case of $filter->or_([AbstractRule, AbstractRule, AbstractRule, ...]) |
| 196 | 196 | foreach ($rules_description[0] as $i => $new_rule) { |
| 197 | - $this->addRule( $new_rule, $operation ); |
|
| 197 | + $this->addRule($new_rule, $operation); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | else { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $fake_root |
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | - $this->addRule( $fake_root->getOperands()[0], $operation ); |
|
| 208 | + $this->addRule($fake_root->getOperands()[0], $operation); |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | else { |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return $this |
| 228 | 228 | */ |
| 229 | - protected function addRule( AbstractRule $rule, $operation=AndRule::operator ) |
|
| 229 | + protected function addRule(AbstractRule $rule, $operation = AndRule::operator) |
|
| 230 | 230 | { |
| 231 | - if ( $this->rules && in_array( get_class($this->rules), [AndRule::class, OrRule::class] ) |
|
| 232 | - && !$this->rules->getOperands() ) { |
|
| 231 | + if ($this->rules && in_array(get_class($this->rules), [AndRule::class, OrRule::class]) |
|
| 232 | + && !$this->rules->getOperands()) { |
|
| 233 | 233 | throw new \LogicException( |
| 234 | 234 | "You are trying to add rules to a LogicalFilter which had " |
| 235 | 235 | ."only contradictory rules that have already been simplified: " |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | array $rules_composition, |
| 279 | 279 | AbstractOperationRule $recursion_position |
| 280 | 280 | ) { |
| 281 | - if (!array_filter($rules_composition, function ($rule_composition_part) { |
|
| 281 | + if (!array_filter($rules_composition, function($rule_composition_part) { |
|
| 282 | 282 | return is_string($rule_composition_part); |
| 283 | 283 | })) { |
| 284 | 284 | // at least one operator is required for operation rules |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | .var_export($rules_composition, true) |
| 288 | 288 | ); |
| 289 | 289 | } |
| 290 | - elseif ( count($rules_composition) == 3 |
|
| 291 | - && !in_array( AndRule::operator, $rules_composition, true ) |
|
| 292 | - && !in_array( OrRule::operator, $rules_composition, true ) |
|
| 293 | - && !in_array( NotRule::operator, $rules_composition, true ) |
|
| 294 | - && !in_array( AbstractRule::findSymbolicOperator( AndRule::operator ), $rules_composition, true ) |
|
| 295 | - && !in_array( AbstractRule::findSymbolicOperator( OrRule::operator ), $rules_composition, true ) |
|
| 296 | - && !in_array( AbstractRule::findSymbolicOperator( NotRule::operator ), $rules_composition, true ) |
|
| 290 | + elseif (count($rules_composition) == 3 |
|
| 291 | + && !in_array(AndRule::operator, $rules_composition, true) |
|
| 292 | + && !in_array(OrRule::operator, $rules_composition, true) |
|
| 293 | + && !in_array(NotRule::operator, $rules_composition, true) |
|
| 294 | + && !in_array(AbstractRule::findSymbolicOperator(AndRule::operator), $rules_composition, true) |
|
| 295 | + && !in_array(AbstractRule::findSymbolicOperator(OrRule::operator), $rules_composition, true) |
|
| 296 | + && !in_array(AbstractRule::findSymbolicOperator(NotRule::operator), $rules_composition, true) |
|
| 297 | 297 | ) { |
| 298 | 298 | // atomic or composit rules |
| 299 | 299 | $operand_left = $rules_composition[0]; |
@@ -303,20 +303,20 @@ discard block |
||
| 303 | 303 | $rule = AbstractRule::generateSimpleRule( |
| 304 | 304 | $operand_left, $operation, $operand_right, $this->getOptions() |
| 305 | 305 | ); |
| 306 | - $recursion_position->addOperand( $rule ); |
|
| 306 | + $recursion_position->addOperand($rule); |
|
| 307 | 307 | } |
| 308 | 308 | else { |
| 309 | 309 | // operations |
| 310 | - if ( $rules_composition[0] == NotRule::operator |
|
| 311 | - || $rules_composition[0] == AbstractRule::findSymbolicOperator( NotRule::operator ) ) { |
|
| 310 | + if ($rules_composition[0] == NotRule::operator |
|
| 311 | + || $rules_composition[0] == AbstractRule::findSymbolicOperator(NotRule::operator)) { |
|
| 312 | 312 | $rule = new NotRule(); |
| 313 | 313 | } |
| 314 | - elseif (in_array( AndRule::operator, $rules_composition ) |
|
| 315 | - || in_array( AbstractRule::findSymbolicOperator( AndRule::operator ), $rules_composition )) { |
|
| 314 | + elseif (in_array(AndRule::operator, $rules_composition) |
|
| 315 | + || in_array(AbstractRule::findSymbolicOperator(AndRule::operator), $rules_composition)) { |
|
| 316 | 316 | $rule = new AndRule(); |
| 317 | 317 | } |
| 318 | - elseif (in_array( OrRule::operator, $rules_composition ) |
|
| 319 | - || in_array( AbstractRule::findSymbolicOperator( OrRule::operator ), $rules_composition ) ) { |
|
| 318 | + elseif (in_array(OrRule::operator, $rules_composition) |
|
| 319 | + || in_array(AbstractRule::findSymbolicOperator(OrRule::operator), $rules_composition)) { |
|
| 320 | 320 | $rule = new OrRule(); |
| 321 | 321 | } |
| 322 | 322 | else { |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $operands_descriptions = array_filter( |
| 332 | 332 | $rules_composition, |
| 333 | - function ($operand) use ($operator) { |
|
| 334 | - return !in_array($operand, [$operator, AbstractRule::findSymbolicOperator( $operator )]); |
|
| 333 | + function($operand) use ($operator) { |
|
| 334 | + return !in_array($operand, [$operator, AbstractRule::findSymbolicOperator($operator)]); |
|
| 335 | 335 | } |
| 336 | 336 | ); |
| 337 | 337 | |
@@ -346,18 +346,18 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | foreach ($operands_descriptions as $i => $operands_description) { |
| 348 | 348 | if ($operands_description === false) { |
| 349 | - $operands_descriptions[ $i ] = ['and']; // FalseRule hack |
|
| 349 | + $operands_descriptions[$i] = ['and']; // FalseRule hack |
|
| 350 | 350 | } |
| 351 | 351 | elseif ($operands_description === null || $operands_description === true) { |
| 352 | 352 | $operands_description = ['and']; |
| 353 | - if ( ! $non_true_rule_descriptions) { |
|
| 353 | + if (!$non_true_rule_descriptions) { |
|
| 354 | 354 | throw new \LogicException( |
| 355 | 355 | "TrueRules are not implemented. Please add " |
| 356 | 356 | ."them to operations having other type of rules" |
| 357 | 357 | ); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - unset($operands_descriptions[ $i ]); |
|
| 360 | + unset($operands_descriptions[$i]); |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | throw new \InvalidArgumentException( |
| 376 | 376 | "Mixing different operations in the same rule level not implemented: \n[" |
| 377 | 377 | . implode(', ', $remaining_operations)."]\n" |
| 378 | - . 'in ' . var_export($rules_composition, true) |
|
| 378 | + . 'in '.var_export($rules_composition, true) |
|
| 379 | 379 | ); |
| 380 | 380 | } |
| 381 | 381 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $recursion_position->addOperand( $rule ); |
|
| 404 | + $recursion_position->addOperand($rule); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | return $this; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | */ |
| 431 | 431 | public function and_() |
| 432 | 432 | { |
| 433 | - $this->addRules( AndRule::operator, func_get_args()); |
|
| 433 | + $this->addRules(AndRule::operator, func_get_args()); |
|
| 434 | 434 | return $this; |
| 435 | 435 | } |
| 436 | 436 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | public function or_() |
| 460 | 460 | { |
| 461 | - $this->addRules( OrRule::operator, func_get_args()); |
|
| 461 | + $this->addRules(OrRule::operator, func_get_args()); |
|
| 462 | 462 | return $this; |
| 463 | 463 | } |
| 464 | 464 | |
@@ -505,12 +505,12 @@ discard block |
||
| 505 | 505 | * @param array $options stop_after | stop_before | |
| 506 | 506 | * @return $this |
| 507 | 507 | */ |
| 508 | - public function simplify($options=[]) |
|
| 508 | + public function simplify($options = []) |
|
| 509 | 509 | { |
| 510 | 510 | if ($this->rules) { |
| 511 | 511 | // AndRule added to make all Operation methods available |
| 512 | 512 | $this->rules = (new AndRule([$this->rules])) |
| 513 | - ->simplify( $options ) |
|
| 513 | + ->simplify($options) |
|
| 514 | 514 | // ->dump(true, false) |
| 515 | 515 | ; |
| 516 | 516 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | * |
| 532 | 532 | * @return bool |
| 533 | 533 | */ |
| 534 | - public function hasSolution($save_simplification=true) |
|
| 534 | + public function hasSolution($save_simplification = true) |
|
| 535 | 535 | { |
| 536 | 536 | if (!$this->rules) |
| 537 | 537 | return true; |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | * |
| 552 | 552 | * @return array A description of the rules. |
| 553 | 553 | */ |
| 554 | - public function toArray(array $options=[]) |
|
| 554 | + public function toArray(array $options = []) |
|
| 555 | 555 | { |
| 556 | 556 | return $this->rules ? $this->rules->toArray($options) : $this->rules; |
| 557 | 557 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | * |
| 564 | 564 | * @return array A description of the rules. |
| 565 | 565 | */ |
| 566 | - public function toString(array $options=[]) |
|
| 566 | + public function toString(array $options = []) |
|
| 567 | 567 | { |
| 568 | 568 | return $this->rules ? $this->rules->toString($options) : $this->rules; |
| 569 | 569 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | * @param mixed $row |
| 602 | 602 | * @return bool |
| 603 | 603 | */ |
| 604 | - public function __invoke($row, $key=null) |
|
| 604 | + public function __invoke($row, $key = null) |
|
| 605 | 605 | { |
| 606 | 606 | return $this->validates($row, $key); |
| 607 | 607 | } |
@@ -649,8 +649,8 @@ discard block |
||
| 649 | 649 | [ |
| 650 | 650 | Filterer::on_row_matches => function($rule, $key, &$rows, $matching_case) use (&$cache_flush_required) { |
| 651 | 651 | // $rule->dump(); |
| 652 | - unset( $rows[$key] ); |
|
| 653 | - if ( ! $rows ) { |
|
| 652 | + unset($rows[$key]); |
|
| 653 | + if (!$rows) { |
|
| 654 | 654 | throw new \Exception( |
| 655 | 655 | "Removing the only rule $rule from the filter $this" |
| 656 | 656 | ."produces a case which has no possible solution due to missing " |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @todo Merge with rules |
| 687 | 687 | */ |
| 688 | - public function keepLeafRulesMatching($filter=[], array $options=[]) |
|
| 688 | + public function keepLeafRulesMatching($filter = [], array $options = []) |
|
| 689 | 689 | { |
| 690 | 690 | $clean_empty_branches = !isset($options['clean_empty_branches']) || $options['clean_empty_branches']; |
| 691 | 691 | |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | // ->dump() |
| 694 | 694 | ; |
| 695 | 695 | |
| 696 | - $options[ Filterer::leaves_only ] = true; |
|
| 696 | + $options[Filterer::leaves_only] = true; |
|
| 697 | 697 | |
| 698 | 698 | $this->rules = (new RuleFilterer)->apply($filter, $this->rules, $options); |
| 699 | 699 | // $this->rules->dump(true); |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $this->rules, |
| 710 | 710 | [ |
| 711 | 711 | Filterer::on_row_matches => function($rule, $key, &$rows) { |
| 712 | - unset( $rows[$key] ); |
|
| 712 | + unset($rows[$key]); |
|
| 713 | 713 | }, |
| 714 | 714 | Filterer::on_row_mismatches => function($rule, $key, &$rows) { |
| 715 | 715 | } |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @todo Merge with rules |
| 735 | 735 | */ |
| 736 | - public function listLeafRulesMatching($filter=[]) |
|
| 736 | + public function listLeafRulesMatching($filter = []) |
|
| 737 | 737 | { |
| 738 | 738 | $filter = (new LogicalFilter($filter, new RuleFilterer)) |
| 739 | 739 | // ->dump() |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | array $siblings |
| 754 | 754 | ) use (&$out) { |
| 755 | 755 | |
| 756 | - if ( !$matching_rule instanceof AndRule |
|
| 756 | + if (!$matching_rule instanceof AndRule |
|
| 757 | 757 | && !$matching_rule instanceof OrRule |
| 758 | 758 | && !$matching_rule instanceof NotRule |
| 759 | 759 | ) { |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | * |
| 777 | 777 | * @todo Make it available on AbstractRule also |
| 778 | 778 | */ |
| 779 | - public function onEachRule($filter=[], $options) |
|
| 779 | + public function onEachRule($filter = [], $options) |
|
| 780 | 780 | { |
| 781 | 781 | $filter = (new LogicalFilter($filter, new RuleFilterer)) |
| 782 | 782 | // ->dump() |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | { |
| 807 | 807 | $this->simplify(['force_logical_core' => true]); |
| 808 | 808 | |
| 809 | - if (! $this->rules) |
|
| 809 | + if (!$this->rules) |
|
| 810 | 810 | return $this; |
| 811 | 811 | |
| 812 | 812 | $operands = $this->rules->getOperands(); |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | * |
| 850 | 850 | * @return LogicalFilter |
| 851 | 851 | */ |
| 852 | - public function saveAs( &$variable ) |
|
| 852 | + public function saveAs(&$variable) |
|
| 853 | 853 | { |
| 854 | 854 | return $variable = $this; |
| 855 | 855 | } |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | * |
| 861 | 861 | * @return LogicalFilter |
| 862 | 862 | */ |
| 863 | - public function saveCopyAs( &$copied_variable ) |
|
| 863 | + public function saveCopyAs(&$copied_variable) |
|
| 864 | 864 | { |
| 865 | 865 | $copied_variable = $this->copy(); |
| 866 | 866 | return $this; |
@@ -873,15 +873,15 @@ discard block |
||
| 873 | 873 | * |
| 874 | 874 | * @return $this |
| 875 | 875 | */ |
| 876 | - public function dump($exit=false, array $options=[]) |
|
| 876 | + public function dump($exit = false, array $options = []) |
|
| 877 | 877 | { |
| 878 | 878 | $default_options = [ |
| 879 | 879 | 'callstack_depth' => 3, |
| 880 | 880 | 'mode' => 'string', |
| 881 | 881 | ]; |
| 882 | 882 | foreach ($default_options as $default_option => &$default_value) { |
| 883 | - if (!isset($options[ $default_option ])) |
|
| 884 | - $options[ $default_option ] = $default_value; |
|
| 883 | + if (!isset($options[$default_option])) |
|
| 884 | + $options[$default_option] = $default_value; |
|
| 885 | 885 | } |
| 886 | 886 | extract($options); |
| 887 | 887 | |
@@ -891,21 +891,21 @@ discard block |
||
| 891 | 891 | else { |
| 892 | 892 | // TODO dump a TrueRule |
| 893 | 893 | $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $callstack_depth); |
| 894 | - $caller = $bt[ $callstack_depth - 2 ]; |
|
| 894 | + $caller = $bt[$callstack_depth - 2]; |
|
| 895 | 895 | |
| 896 | 896 | // get line and file from the previous level of the caller |
| 897 | 897 | // TODO go deeper if this case exist? |
| 898 | 898 | if (!isset($caller['file'])) |
| 899 | - $caller['file'] = $bt[ $callstack_depth - 3 ]['file']; |
|
| 899 | + $caller['file'] = $bt[$callstack_depth - 3]['file']; |
|
| 900 | 900 | if (!isset($caller['line'])) |
| 901 | - $caller['line'] = $bt[ $callstack_depth - 3 ]['line']; |
|
| 901 | + $caller['line'] = $bt[$callstack_depth - 3]['line']; |
|
| 902 | 902 | |
| 903 | 903 | try { |
| 904 | - echo "\n" . $caller['file'] . ':' . $caller['line'] . "\n"; |
|
| 904 | + echo "\n".$caller['file'].':'.$caller['line']."\n"; |
|
| 905 | 905 | var_export($this->toArray($options)); |
| 906 | 906 | } |
| 907 | 907 | catch (\Exception $e) { |
| 908 | - echo "\nError while dumping: " . $e->getMessage() . "\n"; |
|
| 908 | + echo "\nError while dumping: ".$e->getMessage()."\n"; |
|
| 909 | 909 | var_export($caller); |
| 910 | 910 | echo "\n\n"; |
| 911 | 911 | var_export($bt); |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | * |
| 930 | 930 | * @return mixed The filtered data |
| 931 | 931 | */ |
| 932 | - public function applyOn($data_to_filter, $action_on_matches=null, $filterer=null) |
|
| 932 | + public function applyOn($data_to_filter, $action_on_matches = null, $filterer = null) |
|
| 933 | 933 | { |
| 934 | 934 | if (!$filterer) { |
| 935 | 935 | $filterer = $this->getDefaultFilterer(); |
@@ -945,11 +945,11 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | if ($data_to_filter instanceof LogicalFilter) { |
| 948 | - $filtered_rules = $filterer->apply( $this, $data_to_filter->getRules() ); |
|
| 949 | - return $data_to_filter->flushRules()->addRule( $filtered_rules ); |
|
| 948 | + $filtered_rules = $filterer->apply($this, $data_to_filter->getRules()); |
|
| 949 | + return $data_to_filter->flushRules()->addRule($filtered_rules); |
|
| 950 | 950 | } |
| 951 | 951 | else { |
| 952 | - return $filterer->apply( $this, $data_to_filter ); |
|
| 952 | + return $filterer->apply($this, $data_to_filter); |
|
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | * + Null if the target has no sens (operation filtered by field for example) |
| 965 | 965 | * + A rule tree containing the first matching case if there is one. |
| 966 | 966 | */ |
| 967 | - public function validates($value_to_check, $key_to_check=null, $filterer=null) |
|
| 967 | + public function validates($value_to_check, $key_to_check = null, $filterer = null) |
|
| 968 | 968 | { |
| 969 | 969 | if (!$filterer) { |
| 970 | 970 | $filterer = $this->getDefaultFilterer(); |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | ); |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - return $filterer->hasMatchingCase( $this, $value_to_check, $key_to_check ); |
|
| 982 | + return $filterer->hasMatchingCase($this, $value_to_check, $key_to_check); |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | /**/ |