Completed
Pull Request — master (#78)
by David
07:10
created
src/controllers/Controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         $valid_company = false;
52 52
         if ($request->has('vat_number')) {
53 53
             $valid_company = $this->validateVATID($request->get('vat_number'));
54
-            $valid_company = $valid_company['is_valid'];
54
+            $valid_company = $valid_company[ 'is_valid' ];
55 55
             $valid_vat_id = $valid_company;
56 56
         }
57 57
 
Please login to merge, or discard this patch.
src/Mpociot/VatCalculator/Validators/VatCalculatorValidatorExtension.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Mpociot\VatCalculator\Validators;
4 4
 
5
-use Illuminate\Validation\Validator;
6 5
 use Mpociot\VatCalculator\Exceptions\VATCheckUnavailableException;
7 6
 use Mpociot\VatCalculator\Facades\VatCalculator;
8 7
 
Please login to merge, or discard this patch.
src/Mpociot/VatCalculator/VatCalculatorServiceProvider.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $this->app->bind('vatcalculator', '\Mpociot\VatCalculator\VatCalculator');
72 72
 
73
-        $this->app->bind('\Mpociot\VatCalculator\VatCalculator', function ($app) {
73
+        $this->app->bind('\Mpociot\VatCalculator\VatCalculator', function($app) {
74 74
             $config = $app->make('Illuminate\Contracts\Config\Repository');
75 75
 
76 76
             return new \Mpociot\VatCalculator\VatCalculator($config);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function registerFacade()
86 86
     {
87
-        $this->app->booting(function () {
87
+        $this->app->booting(function() {
88 88
             $loader = \Illuminate\Foundation\AliasLoader::getInstance();
89 89
             $loader->alias('VatCalculator', 'Mpociot\VatCalculator\Facades\VatCalculator');
90 90
         });
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             'vatnumber-validator'
110 110
         );
111 111
 
112
-        $this->app['validator']->extend('vat_number',
112
+        $this->app[ 'validator' ]->extend('vat_number',
113 113
             'Mpociot\VatCalculator\Validators\VatCalculatorValidatorExtension@validateVatNumber');
114 114
     }
115 115
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
  * @package Teamwork
10 10
  */
11 11
 
12
-use Illuminate\Support\Facades\Validator;
13 12
 use Illuminate\Support\ServiceProvider;
14 13
 use Mpociot\VatCalculator\Facades\VatCalculator;
15 14
 
Please login to merge, or discard this patch.
src/Mpociot/VatCalculator/VatCalculator.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     /**
533
-     * @param mixed $countryCode
533
+     * @param string $countryCode
534 534
      */
535 535
     public function setCountryCode($countryCode)
536 536
     {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
     }
547 547
 
548 548
     /**
549
-     * @param mixed $postalCode
549
+     * @param string $postalCode
550 550
      */
551 551
     public function setPostalCode($postalCode)
552 552
     {
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
     }
652 652
 
653 653
     /**
654
-     * @param $vatNumber
654
+     * @param string $vatNumber
655 655
      * @param $requestorVatNumber
656 656
      *
657 657
      * @throws VATCheckUnavailableException
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 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
         }
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
         $ip = $this->getClientIP();
426 426
         $url = self::GEOCODE_SERVICE_URL.$ip;
427 427
         $result = file_get_contents($url);
428
-        switch ($result[0]) {
428
+        switch ($result[ 0 ]) {
429 429
             case '1':
430 430
                 $data = explode(';', $result);
431 431
 
432
-                return $data[1];
432
+                return $data[ 1 ];
433 433
                 break;
434 434
             default:
435 435
                 return false;
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     {
448 448
         $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
449 449
 
450
-        return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey));
450
+        return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey));
451 451
     }
452 452
 
453 453
     /**
@@ -622,24 +622,24 @@  discard block
 block discarded – undo
622 622
             return $this->config->get($taxKey, 0);
623 623
         }
624 624
 
625
-        if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) {
626
-            foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
627
-                if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
625
+        if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) {
626
+            foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) {
627
+                if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) {
628 628
                     continue;
629 629
                 }
630
-                if (isset($postalCodeException['name'])) {
631
-                    return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
630
+                if (isset($postalCodeException[ 'name' ])) {
631
+                    return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ];
632 632
                 }
633 633
 
634
-                return $this->taxRules[$postalCodeException['code']]['rate'];
634
+                return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ];
635 635
             }
636 636
         }
637 637
 
638 638
         if ($type !== null) {
639
-            return isset($this->taxRules[strtoupper($countryCode)]['rates'][$type]) ? $this->taxRules[strtoupper($countryCode)]['rates'][$type] : 0;
639
+            return isset($this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ] : 0;
640 640
         }
641 641
 
642
-        return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
642
+        return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0;
643 643
     }
644 644
 
645 645
     /**
@@ -679,11 +679,11 @@  discard block
 block discarded – undo
679 679
      */
680 680
     public function getVATDetails($vatNumber, $requestorVat = null)
681 681
     {
682
-        $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber));
682
+        $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber));
683 683
         $countryCode = substr($vatNumber, 0, 2);
684 684
         $vatNumber = substr($vatNumber, 2);
685 685
 
686
-        if(!$requestorVat) {
686
+        if (!$requestorVat) {
687 687
             $requestorVat = $this->config->get('vat_calculator.business_vat_number');
688 688
         }
689 689
 
Please login to merge, or discard this patch.