@@ -51,7 +51,7 @@ |
||
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 |
@@ -70,7 +70,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -353,10 +353,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |