Passed
Push — main ( a3fefa...605794 )
by Dylan
01:51
created
src/services/Curl.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         }
189 189
 
190 190
         if ($this->_enable_cache && $this->getMethod() === 'GET') {
191
-            $cache_key = urlencode($request_uri) . implode(',', $send_headers);
191
+            $cache_key = urlencode($request_uri).implode(',', $send_headers);
192 192
             if (array_key_exists($cache_key, self::$_cache)) {
193 193
                 return self::$_cache[$cache_key];
194 194
             }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         curl_setopt($ch, CURLOPT_AUTOREFERER, true);
209 209
 
210 210
         if (!empty($send_headers))  curl_setopt($ch, CURLOPT_HTTPHEADER, $send_headers);
211
-        if (!is_null($post_data))   {
211
+        if (!is_null($post_data)) {
212 212
             curl_setopt($ch, CURLOPT_POST, 1);
213 213
             curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
214 214
         }
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
     {
245 245
         if (!self::is_absolute_url($url)) {
246 246
             $isRelative = true;
247
-            $uri = 'http://dummy.com/' . ltrim($url, '/'); 
247
+            $uri = 'http://dummy.com/'.ltrim($url, '/'); 
248 248
             throw new InvalidArgumentException('Curl::setGetVar() requires $url to be an absolute url');
249
-        } else {
249
+        }else {
250 250
             $isRelative = false;
251 251
             $uri = $url;
252 252
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         // try to parse uri
255 255
         $parts = parse_url($uri);
256 256
         if (!$parts) {
257
-            throw new InvalidArgumentException("Can't parse URL: " . $uri);
257
+            throw new InvalidArgumentException("Can't parse URL: ".$uri);
258 258
         }
259 259
 
260 260
         // Parse params and add new variable
@@ -270,21 +270,21 @@  discard block
 block discarded – undo
270 270
 
271 271
         if ($user != '') {
272 272
             // format in either user:[email protected] or [email protected]
273
-            $user .= (isset($parts['pass']) && $parts['pass'] != '') ? ':' . $parts['pass'] . '@' : '@';
273
+            $user .= (isset($parts['pass']) && $parts['pass'] != '') ? ':'.$parts['pass'].'@' : '@';
274 274
         }
275 275
 
276 276
         $host = (isset($parts['host'])) ? $parts['host'] : '';
277
-        $port = (isset($parts['port']) && $parts['port'] != '') ? ':' . $parts['port'] : '';
277
+        $port = (isset($parts['port']) && $parts['port'] != '') ? ':'.$parts['port'] : '';
278 278
         $path = (isset($parts['path']) && $parts['path'] != '') ? $parts['path'] : '';
279 279
 
280 280
         // handle URL params which are existing / new
281
-        $params = ($params) ? '?' . http_build_query($params, null, $separator) : '';
281
+        $params = ($params) ? '?'.http_build_query($params, null, $separator) : '';
282 282
 
283 283
         // keep fragments (anchors) intact.
284
-        $fragment = (isset($parts['fragment']) && $parts['fragment'] != '') ? '#' . $parts['fragment'] : '';
284
+        $fragment = (isset($parts['fragment']) && $parts['fragment'] != '') ? '#'.$parts['fragment'] : '';
285 285
 
286 286
         // Recompile URI segments
287
-        $newUri = $scheme . '://' . $user . $host . $port . $path . $params . $fragment;
287
+        $newUri = $scheme.'://'.$user.$host.$port.$path.$params.$fragment;
288 288
 
289 289
         if ($isRelative) {
290 290
             return str_replace('http://dummy.com/', '', $newUri);
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
     {
302 302
         // Strip off the query and fragment parts of the URL before checking
303 303
         if (($queryPosition = strpos($url, '?')) !== false) {
304
-            $url = substr($url, 0, $queryPosition - 1);
304
+            $url = substr($url, 0, $queryPosition-1);
305 305
         }
306 306
         if (($hashPosition = strpos($url, '#')) !== false) {
307
-            $url = substr($url, 0, $hashPosition - 1);
307
+            $url = substr($url, 0, $hashPosition-1);
308 308
         }
309 309
         $colonPosition = strpos($url, ':');
310 310
         $slashPosition = strpos($url, '/');
Please login to merge, or discard this patch.