Completed
Pull Request — master (#9)
by Marcel
18:08 queued 08:05
created
src/Mpociot/VatCalculator/VatCalculator.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
249 249
     }
250 250
 
251 251
     /**
252
-     * @param $vatNumber
252
+     * @param string $vatNumber
253 253
      *
254 254
      * @throws VATCheckUnavailableException
255 255
      *
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Mpociot/VatCalculator/VatCalculatorServiceProvider.php 2 patches
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
 use Mpociot\VatCalculator\Validators\VatCalculatorValidatorExtension;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
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
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     protected function registerVatCalculator()
72 72
     {
73
-        $this->app->bind('vatcalculator', function ($app) {
73
+        $this->app->bind('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
         });
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
     protected function mergeConfig()
99 99
     {
100 100
         $this->mergeConfigFrom(
101
-            __DIR__.'/../../config/config.php', 'vat_calculator'
101
+            __DIR__ . '/../../config/config.php', 'vat_calculator'
102 102
         );
103 103
     }
104 104
 
105 105
     protected function registerValidatorExtension()
106 106
     {
107 107
         $this->loadTranslationsFrom(
108
-            __DIR__.'/../../lang',
108
+            __DIR__ . '/../../lang',
109 109
             'vatnumber-validator'
110 110
         );
111 111
 
112 112
         // Registering the validator extension with the validator factory
113
-        $this->app['validator']->resolver(
114
-            function ($translator, $data, $rules, $messages, $customAttributes = []) {
113
+        $this->app[ 'validator' ]->resolver(
114
+            function($translator, $data, $rules, $messages, $customAttributes = [ ]) {
115 115
                 return new VatCalculatorValidatorExtension(
116 116
                     $translator,
117 117
                     $data,
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $config = $this->app->make('Illuminate\Contracts\Config\Repository');
133 133
         if ($config->get('vat_calculator.use_routes', true)) {
134
-            include __DIR__.'/../../routes.php';
134
+            include __DIR__ . '/../../routes.php';
135 135
         }
136 136
     }
137 137
 }
Please login to merge, or discard this patch.
src/Mpociot/VatCalculator/Validators/VatCalculatorValidatorExtension.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
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.