@@ -59,30 +59,25 @@ discard block |
||
59 | 59 | new BelowRule($field, $operand->getLowerLimit()), |
60 | 60 | new EqualRule($field, $operand->getLowerLimit()), |
61 | 61 | ]); |
62 | - } |
|
63 | - elseif ($operand instanceof BelowRule) { |
|
62 | + } elseif ($operand instanceof BelowRule) { |
|
64 | 63 | // ! (v > a) : v <= a : (v < a || a = v) |
65 | 64 | $new_rule = new OrRule([ |
66 | 65 | new AboveRule($field, $operand->getUpperLimit()), |
67 | 66 | new EqualRule($field, $operand->getUpperLimit()), |
68 | 67 | ]); |
69 | - } |
|
70 | - elseif ($operand instanceof EqualRule && null === $operand->getValue()) { |
|
68 | + } elseif ($operand instanceof EqualRule && null === $operand->getValue()) { |
|
71 | 69 | $new_rule = new NotEqualRule($field, null); |
72 | - } |
|
73 | - elseif ($operand instanceof EqualRule) { |
|
70 | + } elseif ($operand instanceof EqualRule) { |
|
74 | 71 | // ! (v = a) : (v < a) || (v > a) |
75 | 72 | if ($this->getOption('not_equal.normalization', $current_simplification_options)) { |
76 | 73 | $new_rule = new OrRule([ |
77 | 74 | new AboveRule($field, $operand->getValue()), |
78 | 75 | new BelowRule($field, $operand->getValue()), |
79 | 76 | ]); |
80 | - } |
|
81 | - else { |
|
77 | + } else { |
|
82 | 78 | $new_rule = new NotEqualRule( $field, $operand->getValue() ); |
83 | 79 | } |
84 | - } |
|
85 | - elseif ($operand instanceof NotEqualRule) { |
|
80 | + } elseif ($operand instanceof NotEqualRule) { |
|
86 | 81 | $new_rule = new EqualRule( $field, $operand->getValue() ); |
87 | 82 | } |
88 | 83 | } |
@@ -135,8 +130,7 @@ discard block |
||
135 | 130 | $new_rule->setOperands( $combinations ) |
136 | 131 | // ->dump(true) |
137 | 132 | ; |
138 | - } |
|
139 | - elseif ($operand instanceof OrRule) { |
|
133 | + } elseif ($operand instanceof OrRule) { |
|
140 | 134 | |
141 | 135 | // $operand->dump(true); |
142 | 136 | if ( $operand instanceof InRule |
@@ -147,8 +141,7 @@ discard block |
||
147 | 141 | $operand->getField(), |
148 | 142 | $operand->getPossibilities() |
149 | 143 | ); |
150 | - } |
|
151 | - else { |
|
144 | + } else { |
|
152 | 145 | // ! (A || B) : !A && !B |
153 | 146 | // ! (A || B || C || D) : !A && !B && !C && !D |
154 | 147 | $new_rule = new AndRule; |
@@ -162,8 +155,7 @@ discard block |
||
162 | 155 | } |
163 | 156 | } |
164 | 157 | // $new_rule->dump(!true); |
165 | - } |
|
166 | - elseif ($operand instanceof NotRule) { |
|
158 | + } elseif ($operand instanceof NotRule) { |
|
167 | 159 | // ! ( ! a) : a |
168 | 160 | $new_rule = $operand->getOperandAt(0); |
169 | 161 | } |
@@ -252,8 +244,7 @@ discard block |
||
252 | 244 | // TODO make a dedicated cache entry for semantic array? |
253 | 245 | if ( ! $options['show_instance'] && ! $options['semantic']) { |
254 | 246 | return $this->cache['array'] = $array; |
255 | - } |
|
256 | - else { |
|
247 | + } else { |
|
257 | 248 | return $array; |
258 | 249 | } |
259 | 250 | } |
@@ -309,19 +300,16 @@ discard block |
||
309 | 300 | if ($new_operand instanceof NotRule) { |
310 | 301 | $operands = $new_operand->getOperands(); |
311 | 302 | return reset( $operands ); |
312 | - } |
|
313 | - elseif ($new_operand instanceof EqualRule && ! $this->getOption('not_equal.normalization', $contextual_options)) { |
|
303 | + } elseif ($new_operand instanceof EqualRule && ! $this->getOption('not_equal.normalization', $contextual_options)) { |
|
314 | 304 | return new NotEqualRule( $new_operand->getField(), $new_operand->getValue(), $this->options ); |
315 | - } |
|
316 | - elseif ($new_operand instanceof InRule && ! $this->getOption('not_in.normalization', $contextual_options)) { |
|
305 | + } elseif ($new_operand instanceof InRule && ! $this->getOption('not_in.normalization', $contextual_options)) { |
|
317 | 306 | return new NotInRule( $new_operand->getField(), $new_operand->getPossibilities(), $this->options ); |
318 | 307 | } |
319 | 308 | |
320 | 309 | try { |
321 | 310 | // Don't use addOperand here to allow inheritance for optimizations (e.g. NotInRule) |
322 | 311 | $out = $this->setOperands( $new_operands ); |
323 | - } |
|
324 | - catch (\LogicException $e) { |
|
312 | + } catch (\LogicException $e) { |
|
325 | 313 | $out = new NotRule( $new_operand ); |
326 | 314 | } |
327 | 315 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param string $field The field to apply the rule on. |
19 | 19 | * @param mixed $value The value the field can equal to. |
20 | 20 | */ |
21 | - public function __construct( $field, $value, array $options=[] ) |
|
21 | + public function __construct($field, $value, array $options = []) |
|
22 | 22 | { |
23 | 23 | $this->field = $field; |
24 | 24 | $this->value = $value; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | /** |
31 | 31 | */ |
32 | - public function isNormalizationAllowed(array $contextual_options=[]) |
|
32 | + public function isNormalizationAllowed(array $contextual_options = []) |
|
33 | 33 | { |
34 | 34 | $operand = $this->getOperandAt(0); |
35 | 35 | |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return array |
60 | 60 | */ |
61 | - public function toArray(array $options=[]) |
|
61 | + public function toArray(array $options = []) |
|
62 | 62 | { |
63 | 63 | $default_options = [ |
64 | 64 | 'show_instance' => false, |
65 | 65 | ]; |
66 | 66 | foreach ($default_options as $default_option => &$default_value) { |
67 | - if ( ! isset($options[ $default_option ])) { |
|
68 | - $options[ $default_option ] = $default_value; |
|
67 | + if (!isset($options[$default_option])) { |
|
68 | + $options[$default_option] = $default_value; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - if ( ! $options['show_instance'] && isset($this->cache['array'])) { |
|
72 | + if (!$options['show_instance'] && isset($this->cache['array'])) { |
|
73 | 73 | return $this->cache['array']; |
74 | 74 | } |
75 | 75 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $this->getValue(), |
80 | 80 | ]; |
81 | 81 | |
82 | - if ( ! $options['show_instance']) { |
|
82 | + if (!$options['show_instance']) { |
|
83 | 83 | return $this->cache['array'] = $array; |
84 | 84 | } |
85 | 85 | else { |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | /** |
91 | 91 | */ |
92 | - public function toString(array $options=[]) |
|
92 | + public function toString(array $options = []) |
|
93 | 93 | { |
94 | - if ( ! empty($this->cache['string'])) { |
|
94 | + if (!empty($this->cache['string'])) { |
|
95 | 95 | return $this->cache['string']; |
96 | 96 | } |
97 | 97 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public function hasSolution(array $simplification_options=[]) |
|
111 | + public function hasSolution(array $simplification_options = []) |
|
112 | 112 | { |
113 | 113 | return true; |
114 | 114 | } |