Completed
Push — master ( 9840d9...06e3f7 )
by Marcel
16:37 queued 07:32
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
@@ -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   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
      */
358 358
     private function getClientIP()
359 359
     {
360
-        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
361
-            $clientIpAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
362
-        } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) {
363
-            $clientIpAddress = $_SERVER['REMOTE_ADDR'];
360
+        if (isset($_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) && $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) {
361
+            $clientIpAddress = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ];
362
+        } elseif (isset($_SERVER[ 'REMOTE_ADDR' ]) && $_SERVER[ 'REMOTE_ADDR' ]) {
363
+            $clientIpAddress = $_SERVER[ 'REMOTE_ADDR' ];
364 364
         } else {
365 365
             $clientIpAddress = '';
366 366
         }
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
         $ip = $this->getClientIP();
381 381
         $url = self::GEOCODE_SERVICE_URL.$ip;
382 382
         $result = file_get_contents($url);
383
-        switch ($result[0]) {
383
+        switch ($result[ 0 ]) {
384 384
             case '1':
385 385
                 $data = explode(';', $result);
386 386
 
387
-                return $data[1];
387
+                return $data[ 1 ];
388 388
                 break;
389 389
             default:
390 390
                 return false;
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     {
403 403
         $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
404 404
 
405
-        return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey));
405
+        return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey));
406 406
     }
407 407
 
408 408
     /**
@@ -577,24 +577,24 @@  discard block
 block discarded – undo
577 577
             return $this->config->get($taxKey, 0);
578 578
         }
579 579
 
580
-        if (isset($this->postalCodeExceptions[$countryCode]) && $postalCode !== null) {
581
-            foreach ($this->postalCodeExceptions[$countryCode] as $postalCodeException) {
582
-                if (!preg_match($postalCodeException['postalCode'], $postalCode)) {
580
+        if (isset($this->postalCodeExceptions[ $countryCode ]) && $postalCode !== null) {
581
+            foreach ($this->postalCodeExceptions[ $countryCode ] as $postalCodeException) {
582
+                if (!preg_match($postalCodeException[ 'postalCode' ], $postalCode)) {
583 583
                     continue;
584 584
                 }
585
-                if (isset($postalCodeException['name'])) {
586
-                    return $this->taxRules[$postalCodeException['code']]['exceptions'][$postalCodeException['name']];
585
+                if (isset($postalCodeException[ 'name' ])) {
586
+                    return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'exceptions' ][ $postalCodeException[ 'name' ] ];
587 587
                 }
588 588
 
589
-                return $this->taxRules[$postalCodeException['code']]['rate'];
589
+                return $this->taxRules[ $postalCodeException[ 'code' ] ][ 'rate' ];
590 590
             }
591 591
         }
592 592
 
593 593
         if ($type !== null) {
594
-            return isset($this->taxRules[strtoupper($countryCode)]['rates'][$type]) ? $this->taxRules[strtoupper($countryCode)]['rates'][$type] : 0;
594
+            return isset($this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rates' ][ $type ] : 0;
595 595
         }
596 596
 
597
-        return isset($this->taxRules[strtoupper($countryCode)]['rate']) ? $this->taxRules[strtoupper($countryCode)]['rate'] : 0;
597
+        return isset($this->taxRules[ strtoupper($countryCode) ][ 'rate' ]) ? $this->taxRules[ strtoupper($countryCode) ][ 'rate' ] : 0;
598 598
     }
599 599
 
600 600
     /**
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      */
633 633
     public function getVATDetails($vatNumber)
634 634
     {
635
-        $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber));
635
+        $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber));
636 636
         $countryCode = substr($vatNumber, 0, 2);
637 637
         $vatNumber = substr($vatNumber, 2);
638 638
         $this->initSoapClient();
Please login to merge, or discard this patch.