Passed
Push — master ( e2aca6...c11b4a )
by Clinton
02:18
created
src/Guzzler.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct($maxConcurrent = 10, $usleep = 100000, $userAgent = 'cvweiss/guzzler/', $curlOptions = [])
16 16
     {
17
-	$curlOptions = $curlOptions == [] ? [CURLOPT_FRESH_CONNECT => false] : $curlOptions;
17
+    $curlOptions = $curlOptions == [] ? [CURLOPT_FRESH_CONNECT => false] : $curlOptions;
18 18
 
19 19
         $this->curl = new \GuzzleHttp\Handler\CurlMultiHandler();
20 20
         $this->handler = \GuzzleHttp\HandlerStack::create($this->curl);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $ms = microtime();
34 34
         do {
35 35
             $this->curl->tick();
36
-	    if ($this->concurrent >= $this->maxConcurrent) usleep(max(1, min(1000000, $this->usleep)));
36
+        if ($this->concurrent >= $this->maxConcurrent) usleep(max(1, min(1000000, $this->usleep)));
37 37
         } while ($this->concurrent >= $this->maxConcurrent);
38 38
         return max(0, microtime() - $ms);
39 39
     }
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
         $this->verifyCallable($fulfilled);
61 61
         $this->verifyCallable($rejected);
62 62
 
63
-	while ($this->concurrent >= $this->maxConcurrent) $this->tick();
63
+    while ($this->concurrent >= $this->maxConcurrent) $this->tick();
64 64
 
65
-	$params['uri'] = $uri;
66
-	$params['fulfilled'] = $fulfilled;
67
-	$params['rejected'] = $rejected;
68
-	$params['setup'] = $setup;
69
-	$params['callType'] = $callType;
70
-	$params['body'] = $body;
65
+    $params['uri'] = $uri;
66
+    $params['fulfilled'] = $fulfilled;
67
+    $params['rejected'] = $rejected;
68
+    $params['setup'] = $setup;
69
+    $params['callType'] = $callType;
70
+    $params['body'] = $body;
71 71
 
72
-	$redis = $this->applyEtag($setup, $params);
72
+    $redis = $this->applyEtag($setup, $params);
73 73
 
74 74
         $guzzler = $this;
75 75
         $request = new \GuzzleHttp\Psr7\Request($callType, $uri, $setup, $body);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 $guzzler->dec();
79 79
                 $content = (string) $response->getBody();
80 80
                 $this->lastHeaders = array_change_key_case($response->getHeaders());
81
-		$this->applyEtagPost($this->lastHeaders, $params['uri'], $content, $redis);
81
+        $this->applyEtagPost($this->lastHeaders, $params['uri'], $content, $redis);
82 82
                 $fulfilled($guzzler, $params, $content);
83 83
             },
84 84
             function($connectionException) use (&$guzzler, &$rejected, &$params) {
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
             if ($etag != "") $setup['If-None-Match'] = $etag;
100 100
         }
101 101
         unset($setup['etag']);
102
-	return $redis;
102
+    return $redis;
103 103
     }
104 104
 
105 105
     protected function applyEtagPost($headers, $uri, $content, $redis)
106 106
     {
107 107
         if (isset($headers['etag']) && strlen($content) == 0 && $redis !== null) {
108
-	    $redis->setex("guzzler:etags:$uri", 604800, $headers['etag'][0]);
109
-	}
108
+        $redis->setex("guzzler:etags:$uri", 604800, $headers['etag'][0]);
109
+    }
110 110
     }
111 111
 
112 112
     public function verifyCallable($callable)
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
         $ms = microtime();
34 34
         do {
35 35
             $this->curl->tick();
36
-	    if ($this->concurrent >= $this->maxConcurrent) usleep(max(1, min(1000000, $this->usleep)));
36
+	    if ($this->concurrent >= $this->maxConcurrent) {
37
+	        usleep(max(1, min(1000000, $this->usleep)));
38
+	    }
37 39
         } while ($this->concurrent >= $this->maxConcurrent);
38 40
         return max(0, microtime() - $ms);
39 41
     }
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
         $this->verifyCallable($fulfilled);
61 63
         $this->verifyCallable($rejected);
62 64
 
63
-	while ($this->concurrent >= $this->maxConcurrent) $this->tick();
65
+	while ($this->concurrent >= $this->maxConcurrent) {
66
+	    $this->tick();
67
+	}
64 68
 
65 69
 	$params['uri'] = $uri;
66 70
 	$params['fulfilled'] = $fulfilled;
@@ -96,7 +100,9 @@  discard block
 block discarded – undo
96 100
         $redis = isset($setup['etag']) ? $setup['etag'] : null;
97 101
         if ($redis !== null && $params['callType'] == 'GET') {
98 102
             $etag = $redis->get("guzzler:etags:" . $params['uri']);
99
-            if ($etag != "") $setup['If-None-Match'] = $etag;
103
+            if ($etag != "") {
104
+                $setup['If-None-Match'] = $etag;
105
+            }
100 106
         }
101 107
         unset($setup['etag']);
102 108
 	return $redis;
Please login to merge, or discard this patch.