@@ -412,7 +412,7 @@ |
||
412 | 412 | |
413 | 413 | if ($queued) { |
414 | 414 | $ed = $this->getEventDispatcher(); |
415 | - $ed->addListener('request.before_send', $f = function ($e) use ($response, &$f, $ed) { |
|
415 | + $ed->addListener('request.before_send', $f = function($e) use ($response, &$f, $ed) { |
|
416 | 416 | $e['request']->setResponse($response); |
417 | 417 | $ed->removeListener('request.before_send', $f); |
418 | 418 | }, -9999); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // Add the parent request to the request before it sends (make sure it's before the onRequestClone event too) |
150 | 150 | $redirectRequest->getEventDispatcher()->addListener( |
151 | 151 | 'request.before_send', |
152 | - $func = function ($e) use (&$func, $request, $redirectRequest) { |
|
152 | + $func = function($e) use (&$func, $request, $redirectRequest) { |
|
153 | 153 | $redirectRequest->getEventDispatcher()->removeListener('request.before_send', $func); |
154 | 154 | $e['request']->getParams()->set(RedirectPlugin::PARENT_REQUEST, $request); |
155 | 155 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $original->getEventDispatcher()->addListener( |
242 | 242 | 'request.complete', |
243 | - $func = function ($e) use (&$func, $original, $max) { |
|
243 | + $func = function($e) use (&$func, $original, $max) { |
|
244 | 244 | $original->getEventDispatcher()->removeListener('request.complete', $func); |
245 | 245 | $str = "{$max} redirects were issued for this request:\n" . $e['request']->getRawHeaders(); |
246 | 246 | throw new TooManyRedirectsException($str); |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | $bodyAsString = $requestCurlOptions->get(self::BODY_AS_STRING); |
50 | 50 | |
51 | 51 | // Prepare url |
52 | - $url = (string)$request->getUrl(); |
|
53 | - if(($pos = strpos($url, '#')) !== false ){ |
|
52 | + $url = (string) $request->getUrl(); |
|
53 | + if (($pos = strpos($url, '#')) !== false) { |
|
54 | 54 | // strip fragment from url |
55 | 55 | $url = substr($url, 0, $pos); |
56 | 56 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | if ($requestCurlOptions->get('progress')) { |
205 | 205 | // Wrap the function in a function that provides the curl handle to the mediator's progress function |
206 | 206 | // Using this rather than injecting the handle into the mediator prevents a circular reference |
207 | - $curlOptions[CURLOPT_PROGRESSFUNCTION] = function () use ($mediator, $handle) { |
|
207 | + $curlOptions[CURLOPT_PROGRESSFUNCTION] = function() use ($mediator, $handle) { |
|
208 | 208 | $args = func_get_args(); |
209 | 209 | $args[] = $handle; |
210 | 210 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | protected function createContext(array $params) |
92 | 92 | { |
93 | 93 | $options = $this->contextOptions; |
94 | - $this->context = $this->createResource(function () use ($params, $options) { |
|
94 | + $this->context = $this->createResource(function() use ($params, $options) { |
|
95 | 95 | return stream_context_create($options, $params); |
96 | 96 | }); |
97 | 97 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $http_response_header = null; |
214 | 214 | $url = $this->url; |
215 | 215 | $context = $this->context; |
216 | - $fp = $this->createResource(function () use ($context, $url, &$http_response_header) { |
|
216 | + $fp = $this->createResource(function() use ($context, $url, &$http_response_header) { |
|
217 | 217 | return fopen((string) $url, 'r', false, $context); |
218 | 218 | }); |
219 | 219 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | protected function createResource($callback) |
259 | 259 | { |
260 | 260 | $errors = null; |
261 | - set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { |
|
261 | + set_error_handler(function($_, $msg, $file, $line) use (&$errors) { |
|
262 | 262 | $errors[] = array( |
263 | 263 | 'message' => $msg, |
264 | 264 | 'file' => $file, |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function __construct(\Traversable $iterator, $chunkSize) |
22 | 22 | { |
23 | 23 | $chunkSize = (int) $chunkSize; |
24 | - if ($chunkSize < 0 ) { |
|
24 | + if ($chunkSize < 0) { |
|
25 | 25 | throw new \InvalidArgumentException("The chunk size must be equal or greater than zero; $chunkSize given"); |
26 | 26 | } |
27 | 27 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $params['cache.lookup'] = true; |
128 | 128 | $response->setHeader( |
129 | 129 | 'Age', |
130 | - time() - strtotime($response->getDate() ? : $response->getLastModified() ?: 'now') |
|
130 | + time() - strtotime($response->getDate() ?: $response->getLastModified() ?: 'now') |
|
131 | 131 | ); |
132 | 132 | // Validate that the response satisfies the request |
133 | 133 | if ($this->canResponseSatisfyRequest($request, $response)) { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if ($response = $this->storage->fetch($request)) { |
176 | 176 | $response->setHeader( |
177 | 177 | 'Age', |
178 | - time() - strtotime($response->getLastModified() ? : $response->getDate() ?: 'now') |
|
178 | + time() - strtotime($response->getLastModified() ?: $response->getDate() ?: 'now') |
|
179 | 179 | ); |
180 | 180 | |
181 | 181 | if ($this->canResponseSatisfyFailedRequest($request, $response)) { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | if ($response = $this->storage->fetch($request)) { |
209 | - $response->setHeader('Age', time() - strtotime($response->getDate() ? : 'now')); |
|
209 | + $response->setHeader('Age', time() - strtotime($response->getDate() ?: 'now')); |
|
210 | 210 | if (!$this->canResponseSatisfyFailedRequest($request, $response)) { |
211 | 211 | return; |
212 | 212 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @param string $password Password |
22 | 22 | * @param int $scheme Curl auth scheme |
23 | 23 | */ |
24 | - public function __construct($username, $password, $scheme=CURLAUTH_BASIC) |
|
24 | + public function __construct($username, $password, $scheme = CURLAUTH_BASIC) |
|
25 | 25 | { |
26 | 26 | Version::warn(__CLASS__ . " is deprecated. Use \$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');"); |
27 | 27 | $this->username = $username; |
@@ -184,7 +184,7 @@ |
||
184 | 184 | $item = array_shift($this->queue); |
185 | 185 | if ($item instanceof Response) { |
186 | 186 | if ($this->readBodies && $request instanceof EntityEnclosingRequestInterface) { |
187 | - $request->getEventDispatcher()->addListener('request.sent', $f = function (Event $event) use (&$f) { |
|
187 | + $request->getEventDispatcher()->addListener('request.sent', $f = function(Event $event) use (&$f) { |
|
188 | 188 | while ($data = $event['request']->getBody()->read(8096)); |
189 | 189 | // Remove the listener after one-time use |
190 | 190 | $event['request']->getEventDispatcher()->removeListener('request.sent', $f); |
@@ -104,7 +104,7 @@ |
||
104 | 104 | public function getIterator() |
105 | 105 | { |
106 | 106 | // Return an iterator just like the old iteration of the HistoryPlugin for BC compatibility (use getAll()) |
107 | - return new \ArrayIterator(array_map(function ($entry) { |
|
107 | + return new \ArrayIterator(array_map(function($entry) { |
|
108 | 108 | $entry['request']->getParams()->set('actual_response', $entry['response']); |
109 | 109 | return $entry['request']; |
110 | 110 | }, $this->transactions)); |