@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | function selectAllByOrderId($orderId) |
| 42 | 42 | { |
| 43 | - return $this->model->where('order_id', '=', $orderId)->get(); |
|
| 43 | + return $this->model->where('order_id', '=', $orderId)->get(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | - parent::boot(); |
|
| 56 | + parent::boot(); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function products() |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | protected $table = 'order'; |
| 19 | 19 | |
| 20 | 20 | // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model. |
| 21 | - protected $fillable = ['id', 'validated', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'total_discount', 'coupon_id', 'coupon_title', 'coupon_discount_way', 'coupon_type', 'coupon_value', 'coupon_code', 'coupon_group_title', 'bill_order_address_id', 'delivery_order_address_id', 'order_status_id', 'mollie_payment_id', 'comments', 'present_gender', 'present_occassion', 'present_message', 'browser_detect']; |
|
| 21 | + protected $fillable = ['id', 'validated', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'total_discount', 'coupon_id', 'coupon_title', 'coupon_discount_way', 'coupon_type', 'coupon_value', 'coupon_code', 'coupon_group_title', 'bill_order_address_id', 'delivery_order_address_id', 'order_status_id', 'mollie_payment_id', 'comments', 'present_gender', 'present_occassion', 'present_message', 'browser_detect']; |
|
| 22 | 22 | |
| 23 | 23 | public static function boot() |
| 24 | 24 | { |
| 25 | - static::creating(function ($model) { |
|
| 25 | + static::creating(function($model) { |
|
| 26 | 26 | |
| 27 | 27 | if ($model->created_at) { |
| 28 | 28 | $order = Order::where('shop_id', '=', $model->shop_id)->where('created_at', '>=', Carbon::createFromFormat('Y-m-d H:i:s', $model->created_at)->year)->orderBy('id', 'desc')->first(); |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | |
| 155 | 155 | if (Cart::getConditionsByType('payment_method')->count()) { |
| 156 | 156 | |
| 157 | - $attributes = Cart::getConditionsByType('payment_method')->first()->getAttributes(); |
|
| 157 | + $attributes = Cart::getConditionsByType('payment_method')->first()->getAttributes(); |
|
| 158 | 158 | $paymentMethod = PaymentMethodService::find($attributes['data']['id']); |
| 159 | 159 | $price = $paymentMethod->getPriceDetails(); |
| 160 | 160 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $attributes['shop_id'] = $shopId; |
| 56 | 56 | $attributes['client_id'] = $attributes['user_id']; |
| 57 | - $client = $this->client->selectOneByShopIdAndId($shopId, $attributes['user_id']); |
|
| 57 | + $client = $this->client->selectOneByShopIdAndId($shopId, $attributes['user_id']); |
|
| 58 | 58 | |
| 59 | 59 | $this->model->fill($attributes); |
| 60 | 60 | $this->model->save(); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function orderProductsByClientId($clientId, $shopId) |
| 220 | 220 | { |
| 221 | 221 | |
| 222 | - return $this->modelOrderProduct->with(array('product'))->whereHas('Order', function ($query) use ($clientId, $shopId) { |
|
| 222 | + return $this->modelOrderProduct->with(array('product'))->whereHas('Order', function($query) use ($clientId, $shopId) { |
|
| 223 | 223 | $query->where('client_id', '=', $clientId)->where('shop_id', '=', $shopId); |
| 224 | 224 | }); |
| 225 | 225 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | public function selectBySendingMethodIdAndPaymentMethodId($paymentMethodId, $sendingMethodId) |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - $result = $this->model->with(array('sendingPaymentMethodRelated' => function ($query) use ($paymentMethodId, $sendingMethodId) { |
|
| 22 | - $query->with(array('sendingMethod' => function ($query) use ($sendingMethodId) { |
|
| 21 | + $result = $this->model->with(array('sendingPaymentMethodRelated' => function($query) use ($paymentMethodId, $sendingMethodId) { |
|
| 22 | + $query->with(array('sendingMethod' => function($query) use ($sendingMethodId) { |
|
| 23 | 23 | $query->where('id', '=', $sendingMethodId); |
| 24 | - }, 'paymentMethod' => function ($query) use ($paymentMethodId) { |
|
| 24 | + }, 'paymentMethod' => function($query) use ($paymentMethodId) { |
|
| 25 | 25 | $query->where('id', '=', $paymentMethodId); |
| 26 | 26 | })); |
| 27 | 27 | } )) |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | function selectAllByOrderId($orderId) |
| 59 | 59 | { |
| 60 | - return $this->model->where('order_id', '=', $orderId)->get(); |
|
| 60 | + return $this->model->where('order_id', '=', $orderId)->get(); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | public function __get($name) |
| 10 | 10 | { |
| 11 | - if( $this->has($name) ) return $this->get($name); |
|
| 11 | + if ($this->has($name)) return $this->get($name); |
|
| 12 | 12 | return null; |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | \ No newline at end of file |
@@ -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 |
@@ -594,7 +594,6 @@ |
||
| 594 | 594 | /** |
| 595 | 595 | * get the cart voucher |
| 596 | 596 | * |
| 597 | - |
|
| 598 | 597 | */ |
| 599 | 598 | public function getVoucher() |
| 600 | 599 | { |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | $this->events = $events; |
| 65 | 65 | $this->session = $session; |
| 66 | 66 | $this->instanceName = $instanceName; |
| 67 | - $this->sessionKeyCartItems = $session_key . '_cart_items'; |
|
| 68 | - $this->sessionKeyCartConditions = $session_key . '_cart_conditions'; |
|
| 69 | - $this->sessionKeyCartVoucher = $session_key . '_voucher'; |
|
| 67 | + $this->sessionKeyCartItems = $session_key.'_cart_items'; |
|
| 68 | + $this->sessionKeyCartConditions = $session_key.'_cart_conditions'; |
|
| 69 | + $this->sessionKeyCartVoucher = $session_key.'_voucher'; |
|
| 70 | 70 | $this->fireEvent('created'); |
| 71 | 71 | $this->config = $config; |
| 72 | 72 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function update($id, $data) |
| 153 | 153 | { |
| 154 | - if($this->fireEvent('updating', $data) === false) { |
|
| 154 | + if ($this->fireEvent('updating', $data) === false) { |
|
| 155 | 155 | return false; |
| 156 | 156 | } |
| 157 | 157 | $cart = $this->getContent(); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function addRow($id, $item) |
| 249 | 249 | { |
| 250 | - if($this->fireEvent('adding', $item) === false) { |
|
| 250 | + if ($this->fireEvent('adding', $item) === false) { |
|
| 251 | 251 | return false; |
| 252 | 252 | } |
| 253 | 253 | $cart = $this->getContent(); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $condition->setOrder(!is_null($last) ? $last->getOrder() + 1 : 1); |
| 281 | 281 | } |
| 282 | 282 | $conditions->put($condition->getName(), $condition); |
| 283 | - $conditions = $conditions->sortBy(function ($condition, $key) { |
|
| 283 | + $conditions = $conditions->sortBy(function($condition, $key) { |
|
| 284 | 284 | return $condition->getOrder(); |
| 285 | 285 | }); |
| 286 | 286 | $this->saveConditions($conditions); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function getConditionsByType($type) |
| 320 | 320 | { |
| 321 | - return $this->getConditions()->filter(function (CartCondition $condition) use ($type) { |
|
| 321 | + return $this->getConditions()->filter(function(CartCondition $condition) use ($type) { |
|
| 322 | 322 | return $condition->getType() == $type; |
| 323 | 323 | }); |
| 324 | 324 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | public function removeConditionsByType($type) |
| 335 | 335 | { |
| 336 | - $this->getConditionsByType($type)->each(function ($condition) { |
|
| 336 | + $this->getConditionsByType($type)->each(function($condition) { |
|
| 337 | 337 | $this->removeCartCondition($condition->getName()); |
| 338 | 338 | }); |
| 339 | 339 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | public function getSubTotalWithoutConditions($formatted = true) |
| 445 | 445 | { |
| 446 | 446 | $cart = $this->getContent(); |
| 447 | - $sum = $cart->sum(function ($item) { |
|
| 447 | + $sum = $cart->sum(function($item) { |
|
| 448 | 448 | return $item->getOriginalPriceWithTaxSum(); |
| 449 | 449 | }); |
| 450 | 450 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | public function getSubTotalWithTax($formatted = true) |
| 460 | 460 | { |
| 461 | 461 | $cart = $this->getContent(); |
| 462 | - $sum = $cart->sum(function ($item) { |
|
| 462 | + $sum = $cart->sum(function($item) { |
|
| 463 | 463 | return $item->getOriginalPriceWithTaxSum(false); |
| 464 | 464 | }); |
| 465 | 465 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | public function getSubTotalWithoutTax($formatted = true) |
| 476 | 476 | { |
| 477 | 477 | $cart = $this->getContent(); |
| 478 | - $sum = $cart->sum(function ($item) { |
|
| 478 | + $sum = $cart->sum(function($item) { |
|
| 479 | 479 | return $item->getOriginalPriceWithoutTaxSum(false); |
| 480 | 480 | }); |
| 481 | 481 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $process = 0; |
| 496 | 496 | $conditions = $this |
| 497 | 497 | ->getConditions() |
| 498 | - ->filter(function ($cond) { |
|
| 498 | + ->filter(function($cond) { |
|
| 499 | 499 | return $cond->getTarget() === 'subtotal'; |
| 500 | 500 | }); |
| 501 | 501 | // if no conditions were added, just return the sub total |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | return Helpers::formatValue(floatval($subTotal), $formatted, $this->config); |
| 504 | 504 | } |
| 505 | 505 | $conditions |
| 506 | - ->each(function ($cond) use ($subTotal, &$newTotal, &$process) { |
|
| 506 | + ->each(function($cond) use ($subTotal, &$newTotal, &$process) { |
|
| 507 | 507 | $toBeCalculated = ($process > 0) ? $newTotal : $subTotal; |
| 508 | 508 | $newTotal = $cond->applyCondition($toBeCalculated); |
| 509 | 509 | $process++; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $process = 0; |
| 527 | 527 | $conditions = $this |
| 528 | 528 | ->getConditions() |
| 529 | - ->filter(function ($cond) { |
|
| 529 | + ->filter(function($cond) { |
|
| 530 | 530 | return $cond->getTarget() === 'subtotal'; |
| 531 | 531 | }); |
| 532 | 532 | // if no conditions were added, just return the sub total |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | return $subTotal; |
| 535 | 535 | } |
| 536 | 536 | $conditions |
| 537 | - ->each(function ($cond) use ($subTotal, &$newTotal, &$process) { |
|
| 537 | + ->each(function($cond) use ($subTotal, &$newTotal, &$process) { |
|
| 538 | 538 | $toBeCalculated = ($process > 0) ? $newTotal : $subTotal; |
| 539 | 539 | $newTotal = $cond->applyConditionWithoutTax($toBeCalculated); |
| 540 | 540 | $process++; |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | public function remove($id) |
| 553 | 553 | { |
| 554 | 554 | $cart = $this->getContent(); |
| 555 | - if($this->fireEvent('removing', $id) === false) { |
|
| 555 | + if ($this->fireEvent('removing', $id) === false) { |
|
| 556 | 556 | return false; |
| 557 | 557 | } |
| 558 | 558 | $cart->forget($id); |
@@ -599,18 +599,18 @@ discard block |
||
| 599 | 599 | public function getVoucher() |
| 600 | 600 | { |
| 601 | 601 | $voucher = $this->session->get($this->sessionKeyCartVoucher); |
| 602 | - if($voucher){ |
|
| 602 | + if ($voucher) { |
|
| 603 | 603 | |
| 604 | 604 | $totalWithTax = self::getTotalWithTax(); |
| 605 | 605 | $totalWithoutTax = self::getTotalWithoutTax(); |
| 606 | - $voucher['used_value_with_tax'] = $voucher['value']; |
|
| 607 | - $voucher['used_value_without_tax'] = $voucher['value']; |
|
| 608 | - if($totalWithTax <= $voucher['value']) { |
|
| 609 | - $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax); |
|
| 606 | + $voucher['used_value_with_tax'] = $voucher['value']; |
|
| 607 | + $voucher['used_value_without_tax'] = $voucher['value']; |
|
| 608 | + if ($totalWithTax <= $voucher['value']) { |
|
| 609 | + $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - if($totalWithTax <= $voucher['value']) { |
|
| 613 | - $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax); |
|
| 612 | + if ($totalWithTax <= $voucher['value']) { |
|
| 613 | + $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | $this->session->put($this->sessionKeyCartVoucher, $voucher); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | */ |
| 652 | 652 | public function clear() |
| 653 | 653 | { |
| 654 | - if($this->fireEvent('clearing') === false) { |
|
| 654 | + if ($this->fireEvent('clearing') === false) { |
|
| 655 | 655 | return false; |
| 656 | 656 | } |
| 657 | 657 | $this->session->put( |
@@ -669,6 +669,6 @@ discard block |
||
| 669 | 669 | */ |
| 670 | 670 | protected function fireEvent($name, $value = []) |
| 671 | 671 | { |
| 672 | - return $this->events->fire($this->getInstanceName() . '.' . $name, array_values([$value, $this])); |
|
| 672 | + return $this->events->fire($this->getInstanceName().'.'.$name, array_values([$value, $this])); |
|
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | \ 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) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function isMultiArray($array, $recursive = false) |
| 27 | 27 | { |
| 28 | - if( $recursive ) |
|
| 28 | + if ($recursive) |
|
| 29 | 29 | { |
| 30 | 30 | return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true; |
| 31 | 31 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public static function issetAndHasValueOrAssignDefault(&$var, $default = false) |
| 57 | 57 | { |
| 58 | - if( (isset($var)) && ($var!='') ) return $var; |
|
| 58 | + if ((isset($var)) && ($var != '')) return $var; |
|
| 59 | 59 | |
| 60 | 60 | return $default; |
| 61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public static function formatValue($value, $format_numbers, $config) |
| 64 | 64 | { |
| 65 | 65 | |
| 66 | - if($format_numbers && $config['format_numbers']) { |
|
| 66 | + if ($format_numbers && $config['format_numbers']) { |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | return number_format($value, $config['decimals'], $config['dec_point'], $config['thousands_sep']); |
@@ -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 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $this->args = $args; |
| 28 | 28 | |
| 29 | - if( Helpers::isMultiArray($args) ) |
|
| 29 | + if (Helpers::isMultiArray($args)) |
|
| 30 | 30 | { |
| 31 | 31 | Throw new InvalidConditionException('Multi dimensional array is not supported.'); |
| 32 | 32 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function applyConditionWithoutTax($totalOrSubTotalOrPrice) |
| 129 | 129 | { |
| 130 | - if(isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) { |
|
| 130 | + if (isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) { |
|
| 131 | 131 | return $this->apply($totalOrSubTotalOrPrice, $this->getAttributes()['data']['value_ex_tax']); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -173,19 +173,19 @@ discard block |
||
| 173 | 173 | // has a minus or plus sign so we can decide what to do with the |
| 174 | 174 | // percentage, whether to add or subtract it to the total/subtotal/price |
| 175 | 175 | // if we can't find any plus/minus sign, we will assume it as plus sign |
| 176 | - if( $this->valueIsPercentage($conditionValue) ) |
|
| 176 | + if ($this->valueIsPercentage($conditionValue)) |
|
| 177 | 177 | { |
| 178 | - if( $this->valueIsToBeSubtracted($conditionValue) ) |
|
| 178 | + if ($this->valueIsToBeSubtracted($conditionValue)) |
|
| 179 | 179 | { |
| 180 | - $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
|
| 180 | + $value = Helpers::normalizePrice($this->cleanValue($conditionValue)); |
|
| 181 | 181 | |
| 182 | 182 | $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100); |
| 183 | 183 | |
| 184 | 184 | $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue); |
| 185 | 185 | } |
| 186 | - else if ( $this->valueIsToBeAdded($conditionValue) ) |
|
| 186 | + else if ($this->valueIsToBeAdded($conditionValue)) |
|
| 187 | 187 | { |
| 188 | - $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
|
| 188 | + $value = Helpers::normalizePrice($this->cleanValue($conditionValue)); |
|
| 189 | 189 | |
| 190 | 190 | $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100); |
| 191 | 191 | |
@@ -205,15 +205,15 @@ discard block |
||
| 205 | 205 | // next is we will check if it has a minus/plus sign so then we can just deduct it to total/subtotal/price |
| 206 | 206 | else |
| 207 | 207 | { |
| 208 | - if( $this->valueIsToBeSubtracted($conditionValue) ) |
|
| 208 | + if ($this->valueIsToBeSubtracted($conditionValue)) |
|
| 209 | 209 | { |
| 210 | - $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
|
| 210 | + $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue)); |
|
| 211 | 211 | |
| 212 | 212 | $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue); |
| 213 | 213 | } |
| 214 | - else if ( $this->valueIsToBeAdded($conditionValue) ) |
|
| 214 | + else if ($this->valueIsToBeAdded($conditionValue)) |
|
| 215 | 215 | { |
| 216 | - $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) ); |
|
| 216 | + $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue)); |
|
| 217 | 217 | |
| 218 | 218 | $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue); |
| 219 | 219 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | protected function cleanValue($value) |
| 272 | 272 | { |
| 273 | - return str_replace(array('%','-','+'),'',$value); |
|
| 273 | + return str_replace(array('%', '-', '+'), '', $value); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -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 | |