Completed
Push — master ( 4ec448...3d5bef )
by Marcel
30:11 queued 20:16
created
src/Mpociot/VatCalculator/VatCalculator.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
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
         }
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
     public function getIPBasedCountry()
149 149
     {
150 150
         $ip = $this->getClientIP();
151
-        $url = self::GEOCODE_SERVICE_URL.$ip;
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;
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function shouldCollectVAT($countryCode)
172 172
     {
173
-        $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
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
     /**
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
         if ($company && strtoupper($countryCode) !== strtoupper($this->businessCountryCode)) {
271 271
             return 0;
272 272
         }
273
-        $taxKey = 'vat_calculator.rules.'.strtoupper($countryCode);
273
+        $taxKey = 'vat_calculator.rules.' . strtoupper($countryCode);
274 274
         if (isset($this->config) && $this->config->has($taxKey)) {
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.