Completed
Push — master ( 5d5769...e4de2b )
by Marcel
10s
created
src/Mpociot/VatCalculator/VatCalculator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
      */
354 354
     private function getClientIP()
355 355
     {
356
-        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
357
-            $clientIpAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
358
-        } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) {
359
-            $clientIpAddress = $_SERVER['REMOTE_ADDR'];
356
+        if (isset($_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) && $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) {
357
+            $clientIpAddress = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ];
358
+        } elseif (isset($_SERVER[ 'REMOTE_ADDR' ]) && $_SERVER[ 'REMOTE_ADDR' ]) {
359
+            $clientIpAddress = $_SERVER[ 'REMOTE_ADDR' ];
360 360
         } else {
361 361
             $clientIpAddress = '';
362 362
         }
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
         $ip = $this->getClientIP();
377 377
         $url = self::GEOCODE_SERVICE_URL.$ip;
378 378
         $result = file_get_contents($url);
379
-        switch ($result[0]) {
379
+        switch ($result[ 0 ]) {
380 380
             case '1':
381 381
                 $data = explode(';', $result);
382 382
 
383
-                return $data[1];
383
+                return $data[ 1 ];
384 384
                 break;
385 385
             default:
386 386
                 return false;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     {
399 399
         $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
400 400
 
401
-        return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey));
401
+        return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey));
402 402
     }
403 403
 
404 404
     /**
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
             return $this->config->get($taxKey, 0);
539 539
         }
540 540
 
541
-        if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) {
542
-            foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
543
-                if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
541
+        if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) {
542
+            foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) {
543
+                if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) {
544 544
                     continue;
545 545
                 }
546
-                if (isset($postalCodeException['name'])) {
547
-                    return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
546
+                if (isset($postalCodeException[ 'name' ])) {
547
+                    return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ];
548 548
                 }
549 549
 
550
-                return $this->taxRules[$postalCodeException['code']]['rate'];
550
+                return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ];
551 551
             }
552 552
         }
553 553
 
554
-        return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
554
+        return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0;
555 555
     }
556 556
 
557 557
     /**
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      */
590 590
     public function getVATDetails($vatNumber)
591 591
     {
592
-        $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber));
592
+        $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber));
593 593
         $countryCode = substr($vatNumber, 0, 2);
594 594
         $vatNumber = substr($vatNumber, 2);
595 595
         $this->initSoapClient();
Please login to merge, or discard this patch.