@@ -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 | * |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | public function getIPBasedCountry() |
| 133 | 133 | { |
| 134 | 134 | $ip = $this->getClientIP(); |
| 135 | - $url = self::GEOCODE_SERVICE_URL.$ip; |
|
| 135 | + $url = self::GEOCODE_SERVICE_URL . $ip; |
|
| 136 | 136 | $result = file_get_contents($url); |
| 137 | 137 | switch ($result[ 0 ]) { |
| 138 | 138 | case '1': |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | if ($company) { |
| 233 | 233 | return 0; |
| 234 | 234 | } |
| 235 | - $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode); |
|
| 235 | + $taxKey = 'vat_calculator.rules.' . strtoupper($countryCode); |
|
| 236 | 236 | if (isset($this->config) && $this->config->has($taxKey)) { |
| 237 | 237 | return $this->config->get($taxKey, 0); |
| 238 | 238 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function isValidVATNumber($vatNumber) |
| 259 | 259 | { |
| 260 | - $vatNumber = str_replace([' ', '-', '.', ','], '', trim($vatNumber)); |
|
| 260 | + $vatNumber = str_replace([ ' ', '-', '.', ',' ], '', trim($vatNumber)); |
|
| 261 | 261 | $countryCode = substr($vatNumber, 0, 2); |
| 262 | 262 | $vatNumber = substr($vatNumber, 2); |
| 263 | 263 | |
@@ -9,7 +9,6 @@ |
||
| 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 | use Mpociot\VatCalculator\Validators\VatCalculatorValidatorExtension; |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | // Publish config files |
| 44 | 44 | $this->publishes([ |
| 45 | - __DIR__.'/../../config/config.php' => config_path('vat_calculator.php'), |
|
| 46 | - __DIR__.'/../../public/js/vat_calculator.js' => public_path('js/vat_calculator.js'), |
|
| 45 | + __DIR__ . '/../../config/config.php' => config_path('vat_calculator.php'), |
|
| 46 | + __DIR__ . '/../../public/js/vat_calculator.js' => public_path('js/vat_calculator.js'), |
|
| 47 | 47 | ]); |
| 48 | 48 | |
| 49 | 49 | $this->publishes([ |
| 50 | - __DIR__.'/../../public/js/vat_calculator.js' => base_path('resources/assets/js/vat_calculator.js'), |
|
| 50 | + __DIR__ . '/../../public/js/vat_calculator.js' => base_path('resources/assets/js/vat_calculator.js'), |
|
| 51 | 51 | ], 'vatcalculator-spark'); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $this->app->bind('vatcalculator', '\Mpociot\VatCalculator\VatCalculator'); |
| 74 | 74 | |
| 75 | - $this->app->bind('\Mpociot\VatCalculator\VatCalculator', function ($app) { |
|
| 75 | + $this->app->bind('\Mpociot\VatCalculator\VatCalculator', function($app) { |
|
| 76 | 76 | $config = $app->make('Illuminate\Contracts\Config\Repository'); |
| 77 | 77 | |
| 78 | 78 | return new \Mpociot\VatCalculator\VatCalculator($config); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function registerFacade() |
| 88 | 88 | { |
| 89 | - $this->app->booting(function () { |
|
| 89 | + $this->app->booting(function() { |
|
| 90 | 90 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
| 91 | 91 | $loader->alias('VatCalculator', 'Mpociot\VatCalculator\Facades\VatCalculator'); |
| 92 | 92 | }); |
@@ -100,20 +100,20 @@ discard block |
||
| 100 | 100 | protected function mergeConfig() |
| 101 | 101 | { |
| 102 | 102 | $this->mergeConfigFrom( |
| 103 | - __DIR__.'/../../config/config.php', 'vat_calculator' |
|
| 103 | + __DIR__ . '/../../config/config.php', 'vat_calculator' |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | protected function registerValidatorExtension() |
| 108 | 108 | { |
| 109 | 109 | $this->loadTranslationsFrom( |
| 110 | - __DIR__.'/../../lang', |
|
| 110 | + __DIR__ . '/../../lang', |
|
| 111 | 111 | 'vatnumber-validator' |
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | // Registering the validator extension with the validator factory |
| 115 | - $this->app['validator']->resolver( |
|
| 116 | - function ($translator, $data, $rules, $messages, $customAttributes = []) { |
|
| 115 | + $this->app[ 'validator' ]->resolver( |
|
| 116 | + function($translator, $data, $rules, $messages, $customAttributes = [ ]) { |
|
| 117 | 117 | return new VatCalculatorValidatorExtension( |
| 118 | 118 | $translator, |
| 119 | 119 | $data, |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $config = $this->app->make('Illuminate\Contracts\Config\Repository'); |
| 135 | 135 | if ($config->get('vat_calculator.use_routes', true)) { |
| 136 | - include __DIR__.'/../../routes.php'; |
|
| 136 | + include __DIR__ . '/../../routes.php'; |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Creates a new instance of ValidatorExtension. |
| 13 | 13 | */ |
| 14 | - public function __construct($translator, $data, $rules, $messages, array $customAttributes = []) |
|
| 14 | + public function __construct($translator, $data, $rules, $messages, array $customAttributes = [ ]) |
|
| 15 | 15 | { |
| 16 | 16 | // Set custom validation error messages |
| 17 | - if (!isset($messages['vat_number'])) { |
|
| 18 | - $messages['vat_number'] = $translator->get( |
|
| 17 | + if (!isset($messages[ 'vat_number' ])) { |
|
| 18 | + $messages[ 'vat_number' ] = $translator->get( |
|
| 19 | 19 | 'vatnumber-validator::validation.vat_number' |
| 20 | 20 | ); |
| 21 | 21 | } |
@@ -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 | |