@@ -43,7 +43,7 @@ |
||
43 | 43 | protected function resolveExtension($name, array &$op, array &$operations) |
44 | 44 | { |
45 | 45 | $resolved = array(); |
46 | - $original = empty($op['parameters']) ? false: $op['parameters']; |
|
46 | + $original = empty($op['parameters']) ? false : $op['parameters']; |
|
47 | 47 | $hasClass = !empty($op['class']); |
48 | 48 | foreach ((array) $op['extends'] as $extendedCommand) { |
49 | 49 | if (empty($operations[$extendedCommand])) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | return preg_replace_callback( |
91 | 91 | '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', |
92 | - function (array $matches) use ($request, $response, $handle, &$cache) { |
|
92 | + function(array $matches) use ($request, $response, $handle, &$cache) { |
|
93 | 93 | |
94 | 94 | if (array_key_exists($matches[1], $cache)) { |
95 | 95 | return $cache[$matches[1]]; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $result = $handle ? $handle->getErrorNo() : ''; |
161 | 161 | break; |
162 | 162 | case 'curl_stderr': |
163 | - $result = $handle ? $handle->getStderr() : ''; |
|
163 | + $result = $handle ? $handle->getStderr() : ''; |
|
164 | 164 | break; |
165 | 165 | default: |
166 | 166 | if (strpos($matches[1], 'req_header_') === 0) { |
@@ -63,8 +63,8 @@ |
||
63 | 63 | public function addFailedRequestWithException(RequestInterface $request, \Exception $exception) |
64 | 64 | { |
65 | 65 | $this->add($exception) |
66 | - ->addFailedRequest($request) |
|
67 | - ->exceptionForRequest[spl_object_hash($request)] = $exception; |
|
66 | + ->addFailedRequest($request) |
|
67 | + ->exceptionForRequest[spl_object_hash($request)] = $exception; |
|
68 | 68 | |
69 | 69 | return $this; |
70 | 70 | } |
@@ -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 | } |