Completed
Pull Request — master (#83)
by
unknown
05:34
created
src/Mpociot/VatCalculator/VatCalculator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
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
         }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     {
446 446
         $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
447 447
 
448
-        return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey));
448
+        return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey));
449 449
     }
450 450
 
451 451
     /**
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
             return $this->config->get($taxKey, 0);
621 621
         }
622 622
 
623
-        if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) {
624
-            foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
625
-                if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
623
+        if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) {
624
+            foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) {
625
+                if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) {
626 626
                     continue;
627 627
                 }
628
-                if (isset($postalCodeException['name'])) {
629
-                    return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
628
+                if (isset($postalCodeException[ 'name' ])) {
629
+                    return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ];
630 630
                 }
631 631
 
632
-                return $this->taxRules[$postalCodeException['code']]['rate'];
632
+                return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ];
633 633
             }
634 634
         }
635 635
 
636 636
         if ($type !== null) {
637
-            return isset($this->taxRules[strtoupper($countryCode)]['rates'][$type]) ? $this->taxRules[strtoupper($countryCode)]['rates'][$type] : 0;
637
+            return isset($this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ] : 0;
638 638
         }
639 639
 
640
-        return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
640
+        return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0;
641 641
     }
642 642
 
643 643
     /**
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
      */
676 676
     public function getVATDetails($vatNumber)
677 677
     {
678
-        $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber));
678
+        $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber));
679 679
         $countryCode = substr($vatNumber, 0, 2);
680 680
         $vatNumber = substr($vatNumber, 2);
681 681
         $this->initSoapClient();
Please login to merge, or discard this patch.