@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function findSymbolicOperator($english_operator) |
| 34 | 34 | { |
| 35 | - $association = array_flip( self::$ruleAliases ); |
|
| 36 | - if (isset($association[ $english_operator ])) { |
|
| 37 | - return $association[ $english_operator ]; |
|
| 35 | + $association = array_flip(self::$ruleAliases); |
|
| 36 | + if (isset($association[$english_operator])) { |
|
| 37 | + return $association[$english_operator]; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $english_operator; |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | public static function findEnglishOperator($symbolic_operator) |
| 48 | 48 | { |
| 49 | 49 | $association = self::$ruleAliases; |
| 50 | - if (isset($association[ $symbolic_operator ])) { |
|
| 51 | - return $association[ $symbolic_operator ]; |
|
| 50 | + if (isset($association[$symbolic_operator])) { |
|
| 51 | + return $association[$symbolic_operator]; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return $symbolic_operator; |
@@ -63,16 +63,16 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return AbstractRule |
| 65 | 65 | */ |
| 66 | - public static function generateSimpleRule($field, $type, $values, array $options=[]) |
|
| 66 | + public static function generateSimpleRule($field, $type, $values, array $options = []) |
|
| 67 | 67 | { |
| 68 | - $cache_key = hash('md4', serialize( func_get_args()) ); |
|
| 68 | + $cache_key = hash('md4', serialize(func_get_args())); |
|
| 69 | 69 | if (isset(self::$static_cache['rules_generation'][$cache_key])) { |
| 70 | 70 | return self::$static_cache['rules_generation'][$cache_key]->copy(); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $ruleClass = self::getRuleClass($type); |
| 74 | 74 | |
| 75 | - return self::$static_cache['rules_generation'][$cache_key] = new $ruleClass( $field, $values, $options ); |
|
| 75 | + return self::$static_cache['rules_generation'][$cache_key] = new $ruleClass($field, $values, $options); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | . str_replace('_', '', ucwords($english_rule_operator, '_')) |
| 90 | 90 | . 'Rule'; |
| 91 | 91 | |
| 92 | - if ( ! class_exists( $rule_class)) { |
|
| 92 | + if ( ! class_exists($rule_class)) { |
|
| 93 | 93 | throw new \InvalidArgumentException( |
| 94 | 94 | "The class '$rule_class' corresponding to the operator " |
| 95 | 95 | ."'$rule_operator' / '$english_rule_operator' cannot be found." |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $simplification_step_to_keep = null; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( $this instanceof AbstractAtomicRule |
|
| 55 | + if ($this instanceof AbstractAtomicRule |
|
| 56 | 56 | || $this instanceof NotRule |
| 57 | 57 | || $this instanceof InRule |
| 58 | 58 | || ! $this->isNormalizationAllowed([]) |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | elseif ($this instanceof OrRule) { |
| 72 | 72 | foreach ($this->operands as $i => $operand) { |
| 73 | - if (! $operand instanceof AndRule) { |
|
| 73 | + if ( ! $operand instanceof AndRule) { |
|
| 74 | 74 | $this->operands[$i] = new AndRule([$operand]); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | if ($simplification_step_to_keep) { |
| 87 | 87 | foreach ($operands = $ruleTree->getOperands() as $andOperand) { |
| 88 | - if (! $andOperand instanceof AndRule) { |
|
| 88 | + if ( ! $andOperand instanceof AndRule) { |
|
| 89 | 89 | throw new \LogicException( |
| 90 | 90 | "A rule is intended to be an and case: \n" |
| 91 | 91 | .$andOperand |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return hash('md4', serialize($this->toArray(['semantic' => true]))) // faster but longer |
| 70 | - .'-' |
|
| 71 | - .hash('md4', serialize($this->options)) |
|
| 72 | - ; |
|
| 70 | + .'-' |
|
| 71 | + .hash('md4', serialize($this->options)) |
|
| 72 | + ; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | else { |
| 142 | 142 | throw new \InvalidArgumentException( |
| 143 | - "'mode' option must belong to ['string', 'export', 'dump'] " |
|
| 143 | + "'mode' option must belong to ['string', 'export', 'dump'] " |
|
| 144 | 144 | ."instead of " . var_export($mode, true) |
| 145 | 145 | ); |
| 146 | 146 | } |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - abstract public function toString(array $options=[]); |
|
| 33 | + abstract public function toString(array $options = []); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @return array |
| 37 | 37 | */ |
| 38 | - abstract public function toArray(array $options=[]); |
|
| 38 | + abstract public function toArray(array $options = []); |
|
| 39 | 39 | |
| 40 | 40 | protected $instance_id; |
| 41 | 41 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return $this |
| 83 | 83 | */ |
| 84 | - final public function dump($exit=false, array $options=[]) |
|
| 84 | + final public function dump($exit = false, array $options = []) |
|
| 85 | 85 | { |
| 86 | 86 | $default_options = [ |
| 87 | 87 | 'callstack_depth' => 2, |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | // 'show_instance' => false, |
| 90 | 90 | ]; |
| 91 | 91 | foreach ($default_options as $default_option => &$default_value) { |
| 92 | - if ( ! isset($options[ $default_option ])) { |
|
| 93 | - $options[ $default_option ] = $default_value; |
|
| 92 | + if ( ! isset($options[$default_option])) { |
|
| 93 | + $options[$default_option] = $default_value; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | extract($options); |
| 97 | 97 | |
| 98 | 98 | $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $callstack_depth); |
| 99 | - $caller = $bt[ $callstack_depth - 2 ]; |
|
| 99 | + $caller = $bt[$callstack_depth - 2]; |
|
| 100 | 100 | |
| 101 | - echo "\n" . $caller['file'] . ':' . $caller['line'] . "\n"; |
|
| 101 | + echo "\n".$caller['file'].':'.$caller['line']."\n"; |
|
| 102 | 102 | if ('string' == $mode) { |
| 103 | 103 | if ( ! isset($options['indent_unit'])) { |
| 104 | 104 | $options['indent_unit'] = " "; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | else { |
| 142 | 142 | throw new \InvalidArgumentException( |
| 143 | 143 | "'mode' option must belong to ['string', 'export', 'dump'] " |
| 144 | - ."instead of " . var_export($mode, true) |
|
| 144 | + ."instead of ".var_export($mode, true) |
|
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | echo "\n\n"; |