@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | */ |
403 | 403 | private function getClientIP() |
404 | 404 | { |
405 | - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) { |
|
406 | - $clientIpAddress = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
407 | - } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) { |
|
408 | - $clientIpAddress = $_SERVER['REMOTE_ADDR']; |
|
405 | + if (isset($_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) && $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) { |
|
406 | + $clientIpAddress = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]; |
|
407 | + } elseif (isset($_SERVER[ 'REMOTE_ADDR' ]) && $_SERVER[ 'REMOTE_ADDR' ]) { |
|
408 | + $clientIpAddress = $_SERVER[ 'REMOTE_ADDR' ]; |
|
409 | 409 | } else { |
410 | 410 | $clientIpAddress = ''; |
411 | 411 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function getIPBasedCountry() |
424 | 424 | { |
425 | - if (! $ip = $this->getClientIP()) { |
|
425 | + if (!$ip = $this->getClientIP()) { |
|
426 | 426 | return false; |
427 | 427 | } |
428 | 428 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | { |
450 | 450 | $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode); |
451 | 451 | |
452 | - return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey)); |
|
452 | + return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey)); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -624,24 +624,24 @@ discard block |
||
624 | 624 | return $this->config->get($taxKey, 0); |
625 | 625 | } |
626 | 626 | |
627 | - if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) { |
|
628 | - foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) { |
|
629 | - if (!preg_match($postalCodeException['postalCode'], $postalCode)) { |
|
627 | + if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) { |
|
628 | + foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) { |
|
629 | + if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) { |
|
630 | 630 | continue; |
631 | 631 | } |
632 | - if (isset($postalCodeException['name'])) { |
|
633 | - return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']]; |
|
632 | + if (isset($postalCodeException[ 'name' ])) { |
|
633 | + return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ]; |
|
634 | 634 | } |
635 | 635 | |
636 | - return $this->taxRules[$postalCodeException['code']]['rate']; |
|
636 | + return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ]; |
|
637 | 637 | } |
638 | 638 | } |
639 | 639 | |
640 | 640 | if ($type !== null) { |
641 | - return isset($this->taxRules[strtoupper($countryCode)]['rates'][$type]) ? $this->taxRules[strtoupper($countryCode)]['rates'][$type] : 0; |
|
641 | + return isset($this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ] : 0; |
|
642 | 642 | } |
643 | 643 | |
644 | - return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0; |
|
644 | + return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0; |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | */ |
680 | 680 | public function getVATDetails($vatNumber) |
681 | 681 | { |
682 | - $vatNumber = str_replace([' ', "\xC2\xA0", "\xA0", '-', '.', ','], '', trim($vatNumber)); |
|
682 | + $vatNumber = str_replace([ ' ', "\xC2\xA0", "\xA0", '-', '.', ',' ], '', trim($vatNumber)); |
|
683 | 683 | $countryCode = substr($vatNumber, 0, 2); |
684 | 684 | $vatNumber = substr($vatNumber, 2); |
685 | 685 | $this->initSoapClient(); |