Completed
Push — master ( e17b3f...87ecaa )
by Marcel
16:44 queued 06:38
created
src/Mpociot/VatCalculator/VatCalculator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
      */
360 360
     private function getClientIP()
361 361
     {
362
-        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
363
-            $clientIpAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
364
-        } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) {
365
-            $clientIpAddress = $_SERVER['REMOTE_ADDR'];
362
+        if (isset($_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) && $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) {
363
+            $clientIpAddress = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ];
364
+        } elseif (isset($_SERVER[ 'REMOTE_ADDR' ]) && $_SERVER[ 'REMOTE_ADDR' ]) {
365
+            $clientIpAddress = $_SERVER[ 'REMOTE_ADDR' ];
366 366
         } else {
367 367
             $clientIpAddress = '';
368 368
         }
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
         $ip = $this->getClientIP();
383 383
         $url = self::GEOCODE_SERVICE_URL.$ip;
384 384
         $result = file_get_contents($url);
385
-        switch ($result[0]) {
385
+        switch ($result[ 0 ]) {
386 386
             case '1':
387 387
                 $data = explode(';', $result);
388 388
 
389
-                return $data[1];
389
+                return $data[ 1 ];
390 390
                 break;
391 391
             default:
392 392
                 return false;
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     {
405 405
         $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
406 406
 
407
-        return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey));
407
+        return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey));
408 408
     }
409 409
 
410 410
     /**
@@ -544,20 +544,20 @@  discard block
 block discarded – undo
544 544
             return $this->config->get($taxKey, 0);
545 545
         }
546 546
 
547
-        if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) {
548
-            foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
549
-                if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
547
+        if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) {
548
+            foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) {
549
+                if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) {
550 550
                     continue;
551 551
                 }
552
-                if (isset($postalCodeException['name'])) {
553
-                    return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
552
+                if (isset($postalCodeException[ 'name' ])) {
553
+                    return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ];
554 554
                 }
555 555
 
556
-                return $this->taxRules[$postalCodeException['code']]['rate'];
556
+                return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ];
557 557
             }
558 558
         }
559 559
 
560
-        return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
560
+        return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0;
561 561
     }
562 562
 
563 563
     /**
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
      */
578 578
     public function isValidVATNumber($vatNumber)
579 579
     {
580
-        $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber));
580
+        $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber));
581 581
         $countryCode = substr($vatNumber, 0, 2);
582 582
         $vatNumber = substr($vatNumber, 2);
583 583
 
Please login to merge, or discard this patch.