Completed
Push — master ( 847696...e0da2f )
by Marcel
11:03
created
src/Mpociot/VatCalculator/VatCalculator.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
     }
455 455
 
456 456
     /**
457
-     * @param mixed $countryCode
457
+     * @param string $countryCode
458 458
      */
459 459
     public function setCountryCode($countryCode)
460 460
     {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     }
471 471
 
472 472
     /**
473
-     * @param mixed $postalCode
473
+     * @param string $postalCode
474 474
      */
475 475
     public function setPostalCode($postalCode)
476 476
     {
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
     }
572 572
 
573 573
     /**
574
-     * @param $vatNumber
574
+     * @param string $vatNumber
575 575
      *
576 576
      * @throws VATCheckUnavailableException
577 577
      *
Please login to merge, or discard this 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,18 +544,18 @@  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
-            return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
547
+        if (!isset($this->postalCodeExceptions[ $countryCode ]) || $postalCode === null) {
548
+            return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0;
549 549
         } else {
550
-            foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
551
-                if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
550
+            foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) {
551
+                if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) {
552 552
                     continue;
553 553
                 }
554
-                if (isset($postalCodeException['name'])) {
555
-                    return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
554
+                if (isset($postalCodeException[ 'name' ])) {
555
+                    return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ];
556 556
                 }
557 557
 
558
-                return $this->taxRules[$postalCodeException['code']]['rate'];
558
+                return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ];
559 559
             }
560 560
 
561 561
             return 0;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
      */
580 580
     public function isValidVATNumber($vatNumber)
581 581
     {
582
-        $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber));
582
+        $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber));
583 583
         $countryCode = substr($vatNumber, 0, 2);
584 584
         $vatNumber = substr($vatNumber, 2);
585 585
 
Please login to merge, or discard this patch.