@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | * @param string $field The field to apply the rule on. |
14 | 14 | * @param array $value The value the field can equal to. |
15 | 15 | */ |
16 | - public function __construct( $field, $possibilities ) |
|
16 | + public function __construct($field, $possibilities) |
|
17 | 17 | { |
18 | 18 | $this->addOperand(new InRule($field, $possibilities)); |
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
22 | 22 | */ |
23 | - public function isNormalizationAllowed(array $contextual_options=[]) |
|
23 | + public function isNormalizationAllowed(array $contextual_options = []) |
|
24 | 24 | { |
25 | 25 | $operand = $this->getOperandAt(0); |
26 | - if (! $operand->getPossibilities()) { |
|
26 | + if ( ! $operand->getPossibilities()) { |
|
27 | 27 | return false; |
28 | 28 | } |
29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function getField() |
36 | 36 | { |
37 | - if (! $this->getOperandAt(0)) { |
|
37 | + if ( ! $this->getOperandAt(0)) { |
|
38 | 38 | // TODO a NotRule with no operand should be simplified as |
39 | 39 | // a TrueRule |
40 | 40 | throw new \LogicException( |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function setField($field) |
51 | 51 | { |
52 | - if (! $this->getOperandAt(0)) { |
|
52 | + if ( ! $this->getOperandAt(0)) { |
|
53 | 53 | // TODO a NotRule with no operand should be simplified as |
54 | 54 | // a TrueRule |
55 | 55 | throw new \LogicException( |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function setPossibilities($possibilities) |
80 | 80 | { |
81 | - if ( is_object($possibilities) |
|
81 | + if (is_object($possibilities) |
|
82 | 82 | && method_exists($possibilities, 'toArray') |
83 | 83 | ) { |
84 | 84 | $possibilities = $possibilities->toArray(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | /** |
114 | 114 | */ |
115 | - public function hasSolution(array $contextual_options=[]) |
|
115 | + public function hasSolution(array $contextual_options = []) |
|
116 | 116 | { |
117 | 117 | return true; |
118 | 118 | } |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array |
124 | 124 | */ |
125 | - public function toArray(array $options=[]) |
|
125 | + public function toArray(array $options = []) |
|
126 | 126 | { |
127 | 127 | $default_options = [ |
128 | 128 | 'show_instance' => false, |
129 | 129 | ]; |
130 | 130 | foreach ($default_options as $default_option => &$default_value) { |
131 | - if ( ! isset($options[ $default_option ])) { |
|
132 | - $options[ $default_option ] = $default_value; |
|
131 | + if ( ! isset($options[$default_option])) { |
|
132 | + $options[$default_option] = $default_value; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * @todo cache support |
150 | 150 | */ |
151 | - public function toString(array $options=[]) |
|
151 | + public function toString(array $options = []) |
|
152 | 152 | { |
153 | 153 | try { |
154 | 154 | $operator = self::operator; |
155 | 155 | |
156 | - $stringified_possibilities = '[' . implode(', ', array_map(function($possibility) { |
|
156 | + $stringified_possibilities = '['.implode(', ', array_map(function($possibility) { |
|
157 | 157 | return var_export($possibility, true); |
158 | - }, $this->getPossibilities()) ) .']'; |
|
158 | + }, $this->getPossibilities())).']'; |
|
159 | 159 | |
160 | 160 | return "['{$this->getField()}', '$operator', $stringified_possibilities]"; |
161 | 161 | } |