@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | if($event->order->type == 'pre_order') { |
100 | 100 | |
101 | - }elseif($event->order->type == 'from_stock') { |
|
101 | + } elseif($event->order->type == 'from_stock') { |
|
102 | 102 | |
103 | 103 | } |
104 | 104 |
@@ -8,7 +8,9 @@ |
||
8 | 8 | |
9 | 9 | public function __get($name) |
10 | 10 | { |
11 | - if( $this->has($name) ) return $this->get($name); |
|
11 | + if( $this->has($name) ) { |
|
12 | + return $this->get($name); |
|
13 | + } |
|
12 | 14 | return null; |
13 | 15 | } |
14 | 16 | } |
15 | 17 | \ No newline at end of file |
@@ -272,7 +272,9 @@ |
||
272 | 272 | } |
273 | 273 | return $this; |
274 | 274 | } |
275 | - if (!$condition instanceof CartCondition) throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\''); |
|
275 | + if (!$condition instanceof CartCondition) { |
|
276 | + throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\''); |
|
277 | + } |
|
276 | 278 | $conditions = $this->getConditions(); |
277 | 279 | // Check if order has been applied |
278 | 280 | if ($condition->getOrder() == 0) { |
@@ -28,16 +28,14 @@ discard block |
||
28 | 28 | if( $recursive ) |
29 | 29 | { |
30 | 30 | return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true; |
31 | - } |
|
32 | - else |
|
31 | + } else |
|
33 | 32 | { |
34 | 33 | foreach ($array as $k => $v) |
35 | 34 | { |
36 | 35 | if (is_array($v)) |
37 | 36 | { |
38 | 37 | return true; |
39 | - } |
|
40 | - else |
|
38 | + } else |
|
41 | 39 | { |
42 | 40 | return false; |
43 | 41 | } |
@@ -55,7 +53,9 @@ discard block |
||
55 | 53 | */ |
56 | 54 | public static function issetAndHasValueOrAssignDefault(&$var, $default = false) |
57 | 55 | { |
58 | - if( (isset($var)) && ($var!='') ) return $var; |
|
56 | + if( (isset($var)) && ($var!='') ) { |
|
57 | + return $var; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | return $default; |
61 | 61 | } |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | if( Helpers::isMultiArray($args) ) |
30 | 30 | { |
31 | 31 | Throw new InvalidConditionException('Multi dimensional array is not supported.'); |
32 | - } |
|
33 | - else |
|
32 | + } else |
|
34 | 33 | { |
35 | 34 | $this->validate($this->args); |
36 | 35 | } |
@@ -182,16 +181,14 @@ discard block |
||
182 | 181 | $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100); |
183 | 182 | |
184 | 183 | $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue); |
185 | - } |
|
186 | - else if ( $this->valueIsToBeAdded($conditionValue) ) |
|
184 | + } else if ( $this->valueIsToBeAdded($conditionValue) ) |
|
187 | 185 | { |
188 | 186 | $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
189 | 187 | |
190 | 188 | $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100); |
191 | 189 | |
192 | 190 | $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue); |
193 | - } |
|
194 | - else |
|
191 | + } else |
|
195 | 192 | { |
196 | 193 | $value = Helpers::normalizePrice($conditionValue); |
197 | 194 | |
@@ -210,14 +207,12 @@ discard block |
||
210 | 207 | $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
211 | 208 | |
212 | 209 | $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue); |
213 | - } |
|
214 | - else if ( $this->valueIsToBeAdded($conditionValue) ) |
|
210 | + } else if ( $this->valueIsToBeAdded($conditionValue) ) |
|
215 | 211 | { |
216 | 212 | $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
217 | 213 | |
218 | 214 | $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue); |
219 | - } |
|
220 | - else |
|
215 | + } else |
|
221 | 216 | { |
222 | 217 | $this->parsedRawValue = Helpers::normalizePrice($conditionValue); |
223 | 218 |
@@ -81,8 +81,7 @@ discard block |
||
81 | 81 | $processed++; |
82 | 82 | } |
83 | 83 | } |
84 | - } |
|
85 | - else |
|
84 | + } else |
|
86 | 85 | { |
87 | 86 | if( $this['conditions']->getTarget() === 'item' ) |
88 | 87 | { |
@@ -120,8 +119,7 @@ discard block |
||
120 | 119 | $processed++; |
121 | 120 | } |
122 | 121 | } |
123 | - } |
|
124 | - else |
|
122 | + } else |
|
125 | 123 | { |
126 | 124 | if( $this['conditions']->getTarget() === 'item' ) |
127 | 125 | { |
@@ -159,7 +157,9 @@ discard block |
||
159 | 157 | |
160 | 158 | public function __get($name) |
161 | 159 | { |
162 | - if( $this->has($name) ) return $this->get($name); |
|
160 | + if( $this->has($name) ) { |
|
161 | + return $this->get($name); |
|
162 | + } |
|
163 | 163 | return null; |
164 | 164 | } |
165 | 165 | |
@@ -170,13 +170,17 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function hasConditions() |
172 | 172 | { |
173 | - if( ! isset($this['conditions']) ) return false; |
|
173 | + if( ! isset($this['conditions']) ) { |
|
174 | + return false; |
|
175 | + } |
|
174 | 176 | if( is_array($this['conditions']) ) |
175 | 177 | { |
176 | 178 | return count($this['conditions']) > 0; |
177 | 179 | } |
178 | 180 | $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition"; |
179 | - if( $this['conditions'] instanceof $conditionInstance ) return true; |
|
181 | + if( $this['conditions'] instanceof $conditionInstance ) { |
|
182 | + return true; |
|
183 | + } |
|
180 | 184 | return false; |
181 | 185 | } |
182 | 186 | |
@@ -187,7 +191,9 @@ discard block |
||
187 | 191 | */ |
188 | 192 | public function getConditions() |
189 | 193 | { |
190 | - if(! $this->hasConditions() ) return []; |
|
194 | + if(! $this->hasConditions() ) { |
|
195 | + return []; |
|
196 | + } |
|
191 | 197 | return $this['conditions']; |
192 | 198 | } |
193 | 199 | } |
194 | 200 | \ No newline at end of file |