@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | - * @param mixed $countryCode |
|
| 191 | + * @param string $countryCode |
|
| 192 | 192 | */ |
| 193 | 193 | public function setCountryCode($countryCode) |
| 194 | 194 | { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | - * @param $vatNumber |
|
| 252 | + * @param string $vatNumber |
|
| 253 | 253 | * |
| 254 | 254 | * @throws VATCheckUnavailableException |
| 255 | 255 | * |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | private function getClientIP() |
| 129 | 129 | { |
| 130 | - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) { |
|
| 131 | - $clientIpAddress = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
| 132 | - } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) { |
|
| 133 | - $clientIpAddress = $_SERVER['REMOTE_ADDR']; |
|
| 130 | + if (isset($_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) && $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]) { |
|
| 131 | + $clientIpAddress = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]; |
|
| 132 | + } elseif (isset($_SERVER[ 'REMOTE_ADDR' ]) && $_SERVER[ 'REMOTE_ADDR' ]) { |
|
| 133 | + $clientIpAddress = $_SERVER[ 'REMOTE_ADDR' ]; |
|
| 134 | 134 | } else { |
| 135 | 135 | $clientIpAddress = ''; |
| 136 | 136 | } |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | $ip = $this->getClientIP(); |
| 151 | 151 | $url = self::GEOCODE_SERVICE_URL.$ip; |
| 152 | 152 | $result = file_get_contents($url); |
| 153 | - switch ($result[0]) { |
|
| 153 | + switch ($result[ 0 ]) { |
|
| 154 | 154 | case '1': |
| 155 | 155 | $data = explode(';', $result); |
| 156 | 156 | |
| 157 | - return $data[1]; |
|
| 157 | + return $data[ 1 ]; |
|
| 158 | 158 | break; |
| 159 | 159 | default: |
| 160 | 160 | return false; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode); |
| 174 | 174 | |
| 175 | - return isset($this->taxRules[strtoupper($countryCode)]) || (isset($this->config) && $this->config->has($taxKey)); |
|
| 175 | + return isset($this->taxRules[ strtoupper($countryCode) ]) || (isset($this->config) && $this->config->has($taxKey)); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return $this->config->get($taxKey, 0); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - return isset($this->taxRules[strtoupper($countryCode)]) ? $this->taxRules[strtoupper($countryCode)] : 0; |
|
| 278 | + return isset($this->taxRules[ strtoupper($countryCode) ]) ? $this->taxRules[ strtoupper($countryCode) ] : 0; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function isValidVATNumber($vatNumber) |
| 297 | 297 | { |
| 298 | - $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber)); |
|
| 298 | + $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber)); |
|
| 299 | 299 | $countryCode = substr($vatNumber, 0, 2); |
| 300 | 300 | $vatNumber = substr($vatNumber, 2); |
| 301 | 301 | |
@@ -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 | |
@@ -2,7 +2,6 @@ |
||
| 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 | |
@@ -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 | |