@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | */ |
358 | 358 | private function getClientIP() |
359 | 359 | { |
360 | - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) { |
|
361 | - $clientIpAddress = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
362 | - } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) { |
|
363 | - $clientIpAddress = $_SERVER['REMOTE_ADDR']; |
|
360 | + if (isset($_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) && $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) { |
|
361 | + $clientIpAddress = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]; |
|
362 | + } elseif (isset($_SERVER[ 'REMOTE_ADDR' ]) && $_SERVER[ 'REMOTE_ADDR' ]) { |
|
363 | + $clientIpAddress = $_SERVER[ 'REMOTE_ADDR' ]; |
|
364 | 364 | } else { |
365 | 365 | $clientIpAddress = ''; |
366 | 366 | } |
@@ -380,11 +380,11 @@ discard block |
||
380 | 380 | $ip = $this->getClientIP(); |
381 | 381 | $url = self::GEOCODE_SERVICE_URL.$ip; |
382 | 382 | $result = file_get_contents($url); |
383 | - switch ($result[0]) { |
|
383 | + switch ($result[ 0 ]) { |
|
384 | 384 | case '1': |
385 | 385 | $data = explode(';', $result); |
386 | 386 | |
387 | - return $data[1]; |
|
387 | + return $data[ 1 ]; |
|
388 | 388 | break; |
389 | 389 | default: |
390 | 390 | return false; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | { |
403 | 403 | $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode); |
404 | 404 | |
405 | - return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey)); |
|
405 | + return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey)); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -577,24 +577,24 @@ discard block |
||
577 | 577 | return $this->config->get($taxKey, 0); |
578 | 578 | } |
579 | 579 | |
580 | - if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) { |
|
581 | - foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) { |
|
582 | - if (!preg_match($postalCodeException['postalCode'], $postalCode)) { |
|
580 | + if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) { |
|
581 | + foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) { |
|
582 | + if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) { |
|
583 | 583 | continue; |
584 | 584 | } |
585 | - if (isset($postalCodeException['name'])) { |
|
586 | - return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']]; |
|
585 | + if (isset($postalCodeException[ 'name' ])) { |
|
586 | + return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ]; |
|
587 | 587 | } |
588 | 588 | |
589 | - return $this->taxRules[$postalCodeException['code']]['rate']; |
|
589 | + return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ]; |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
593 | 593 | if ($type !== null) { |
594 | - return isset($this->taxRules[strtoupper($countryCode)]['rates'][$type]) ? $this->taxRules[strtoupper($countryCode)]['rates'][$type] : 0; |
|
594 | + return isset($this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ] : 0; |
|
595 | 595 | } |
596 | 596 | |
597 | - return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0; |
|
597 | + return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0; |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | */ |
633 | 633 | public function getVATDetails($vatNumber) |
634 | 634 | { |
635 | - $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber)); |
|
635 | + $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber)); |
|
636 | 636 | $countryCode = substr($vatNumber, 0, 2); |
637 | 637 | $vatNumber = substr($vatNumber, 2); |
638 | 638 | $this->initSoapClient(); |