@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @see fsockopen_header |
83 | 83 | * @param Requests_Hooks $hooks Hook system |
84 | 84 | */ |
85 | - public function register(Requests_Hooks &$hooks) { |
|
85 | + public function register(Requests_Hooks & $hooks) { |
|
86 | 86 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
87 | 87 | |
88 | 88 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
@@ -146,6 +146,6 @@ discard block |
||
146 | 146 | * @return string |
147 | 147 | */ |
148 | 148 | public function get_auth_string() { |
149 | - return $this->user . ':' . $this->pass; |
|
149 | + return $this->user.':'.$this->pass; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | \ No newline at end of file |
@@ -57,16 +57,13 @@ |
||
57 | 57 | public function __construct($args = null) { |
58 | 58 | if (is_string($args)) { |
59 | 59 | $this->proxy = $args; |
60 | - } |
|
61 | - elseif (is_array($args)) { |
|
60 | + } elseif (is_array($args)) { |
|
62 | 61 | if (count($args) == 1) { |
63 | 62 | list($this->proxy) = $args; |
64 | - } |
|
65 | - elseif (count($args) == 3) { |
|
63 | + } elseif (count($args) == 3) { |
|
66 | 64 | list($this->proxy, $this->user, $this->pass) = $args; |
67 | 65 | $this->use_authentication = true; |
68 | - } |
|
69 | - else { |
|
66 | + } else { |
|
70 | 67 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
71 | 68 | } |
72 | 69 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | $string = self::punycode_encode($string); |
94 | 94 | |
95 | 95 | // Step 7: Prepend ACE prefix |
96 | - $string = self::ACE_PREFIX . $string; |
|
96 | + $string = self::ACE_PREFIX.$string; |
|
97 | 97 | |
98 | 98 | // Step 8: Check size |
99 | 99 | if (strlen($string) < 64) { |
@@ -291,11 +291,9 @@ |
||
291 | 291 | # tmax if k >= bias + tmax, or k - bias otherwise |
292 | 292 | if ($k <= ($bias + self::BOOTSTRAP_TMIN)) { |
293 | 293 | $t = self::BOOTSTRAP_TMIN; |
294 | - } |
|
295 | - elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) { |
|
294 | + } elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) { |
|
296 | 295 | $t = self::BOOTSTRAP_TMAX; |
297 | - } |
|
298 | - else { |
|
296 | + } else { |
|
299 | 297 | $t = $k - $bias; |
300 | 298 | } |
301 | 299 | # if q < t then break |
@@ -29,5 +29,5 @@ |
||
29 | 29 | * @see Requests_Hooks::register |
30 | 30 | * @param Requests_Hooks $hooks Hook system |
31 | 31 | */ |
32 | - public function register(Requests_Hooks &$hooks); |
|
32 | + public function register(Requests_Hooks & $hooks); |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -112,8 +112,7 @@ |
||
112 | 112 | if (!$allow_redirects) { |
113 | 113 | throw new Requests_Exception('Redirection not allowed', 'response.no_redirects', $this); |
114 | 114 | } |
115 | - } |
|
116 | - elseif (!$this->success) { |
|
115 | + } elseif (!$this->success) { |
|
117 | 116 | $exception = Requests_Exception_HTTP::get_class($this->status_code); |
118 | 117 | throw new $exception(null, $this); |
119 | 118 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @see fsockopen_header |
54 | 54 | * @param Requests_Hooks $hooks Hook system |
55 | 55 | */ |
56 | - public function register(Requests_Hooks &$hooks) { |
|
56 | + public function register(Requests_Hooks & $hooks) { |
|
57 | 57 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
58 | 58 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); |
59 | 59 | } |
@@ -83,6 +83,6 @@ discard block |
||
83 | 83 | * @return string |
84 | 84 | */ |
85 | 85 | public function getAuthString() { |
86 | - return $this->user . ':' . $this->pass; |
|
86 | + return $this->user.':'.$this->pass; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | \ No newline at end of file |
@@ -162,7 +162,7 @@ |
||
162 | 162 | * |
163 | 163 | * @var Requests_Response $response |
164 | 164 | */ |
165 | - public function before_redirect_check(Requests_Response &$return) { |
|
165 | + public function before_redirect_check(Requests_Response & $return) { |
|
166 | 166 | $url = $return->url; |
167 | 167 | if (!$url instanceof Requests_IRI) { |
168 | 168 | $url = new Requests_IRI($url); |
@@ -249,8 +249,7 @@ |
||
249 | 249 | if (is_array($this->data)) { |
250 | 250 | $request['data'] = $this->data; |
251 | 251 | } |
252 | - } |
|
253 | - elseif (is_array($request['data']) && is_array($this->data)) { |
|
252 | + } elseif (is_array($request['data']) && is_array($this->data)) { |
|
254 | 253 | $request['data'] = array_merge($this->data, $request['data']); |
255 | 254 | } |
256 | 255 |
@@ -344,7 +344,7 @@ |
||
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | - $header_value .= '; ' . implode('; ', $parts); |
|
347 | + $header_value .= '; '.implode('; ', $parts); |
|
348 | 348 | } |
349 | 349 | return $header_value; |
350 | 350 | } |
@@ -280,8 +280,7 @@ discard block |
||
280 | 280 | $delta_seconds = (int) $value; |
281 | 281 | if ($delta_seconds <= 0) { |
282 | 282 | $expiry_time = 0; |
283 | - } |
|
284 | - else { |
|
283 | + } else { |
|
285 | 284 | $expiry_time = $this->reference_time + $delta_seconds; |
286 | 285 | } |
287 | 286 | |
@@ -338,8 +337,7 @@ discard block |
||
338 | 337 | // Ignore non-associative attributes |
339 | 338 | if (is_numeric($key)) { |
340 | 339 | $parts[] = $value; |
341 | - } |
|
342 | - else { |
|
340 | + } else { |
|
343 | 341 | $parts[] = sprintf('%s=%s', $key, $value); |
344 | 342 | } |
345 | 343 | } |
@@ -385,8 +383,7 @@ discard block |
||
385 | 383 | |
386 | 384 | if (!empty($name)) { |
387 | 385 | $value = $string; |
388 | - } |
|
389 | - elseif (strpos($kvparts, '=') === false) { |
|
386 | + } elseif (strpos($kvparts, '=') === false) { |
|
390 | 387 | // Some sites might only have a value without the equals separator. |
391 | 388 | // Deviate from RFC 6265 and pretend it was actually a blank name |
392 | 389 | // (`=foo`) |
@@ -394,8 +391,7 @@ discard block |
||
394 | 391 | // https://bugzilla.mozilla.org/show_bug.cgi?id=169091 |
395 | 392 | $name = ''; |
396 | 393 | $value = $kvparts; |
397 | - } |
|
398 | - else { |
|
394 | + } else { |
|
399 | 395 | list($name, $value) = explode('=', $kvparts, 2); |
400 | 396 | } |
401 | 397 | $name = trim($name); |
@@ -409,8 +405,7 @@ discard block |
||
409 | 405 | if (strpos($part, '=') === false) { |
410 | 406 | $part_key = $part; |
411 | 407 | $part_value = true; |
412 | - } |
|
413 | - else { |
|
408 | + } else { |
|
414 | 409 | list($part_key, $part_value) = explode('=', $part, 2); |
415 | 410 | $part_value = trim($part_value); |
416 | 411 | } |
@@ -445,8 +440,7 @@ discard block |
||
445 | 440 | if (empty($parsed->attributes['domain']) && !empty($origin)) { |
446 | 441 | $parsed->attributes['domain'] = $origin->host; |
447 | 442 | $parsed->flags['host-only'] = true; |
448 | - } |
|
449 | - else { |
|
443 | + } else { |
|
450 | 444 | $parsed->flags['host-only'] = false; |
451 | 445 | } |
452 | 446 | |
@@ -460,14 +454,12 @@ discard block |
||
460 | 454 | // the uri-path is not a %x2F ("/") character, output |
461 | 455 | // %x2F ("/") and skip the remaining steps. |
462 | 456 | $path = '/'; |
463 | - } |
|
464 | - elseif (substr_count($path, '/') === 1) { |
|
457 | + } elseif (substr_count($path, '/') === 1) { |
|
465 | 458 | // If the uri-path contains no more than one %x2F ("/") |
466 | 459 | // character, output %x2F ("/") and skip the remaining |
467 | 460 | // step. |
468 | 461 | $path = '/'; |
469 | - } |
|
470 | - else { |
|
462 | + } else { |
|
471 | 463 | // Output the characters of the uri-path from the first |
472 | 464 | // character up to, but not including, the right-most |
473 | 465 | // %x2F ("/"). |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $options['hooks']->dispatch('curl.before_request', array(&$this->handle)); |
311 | 311 | |
312 | 312 | // Force closing the connection for old versions of cURL (<7.22). |
313 | - if ( ! isset( $headers['Connection'] ) ) { |
|
313 | + if (!isset($headers['Connection'])) { |
|
314 | 314 | $headers['Connection'] = 'close'; |
315 | 315 | } |
316 | 316 | |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | $query = $url_parts['query']; |
506 | 506 | } |
507 | 507 | |
508 | - $query .= '&' . http_build_query($data, null, '&'); |
|
508 | + $query .= '&'.http_build_query($data, null, '&'); |
|
509 | 509 | $query = trim($query, '&'); |
510 | 510 | |
511 | 511 | if (empty($url_parts['query'])) { |
512 | - $url .= '?' . $query; |
|
512 | + $url .= '?'.$query; |
|
513 | 513 | } |
514 | 514 | else { |
515 | 515 | $url = str_replace($url_parts['query'], $query, $url); |
@@ -149,8 +149,7 @@ discard block |
||
149 | 149 | if ($options['verify'] === false) { |
150 | 150 | curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, 0); |
151 | 151 | curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, 0); |
152 | - } |
|
153 | - elseif (is_string($options['verify'])) { |
|
152 | + } elseif (is_string($options['verify'])) { |
|
154 | 153 | curl_setopt($this->handle, CURLOPT_CAINFO, $options['verify']); |
155 | 154 | } |
156 | 155 | } |
@@ -246,8 +245,7 @@ discard block |
||
246 | 245 | ); |
247 | 246 | $responses[$key] = $exception; |
248 | 247 | $options['hooks']->dispatch('transport.internal.parse_error', array(&$responses[$key], $requests[$key])); |
249 | - } |
|
250 | - else { |
|
248 | + } else { |
|
251 | 249 | $responses[$key] = $subrequests[$key]->process_response($subrequests[$key]->response_data, $options); |
252 | 250 | |
253 | 251 | $options['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$key], $requests[$key])); |
@@ -322,8 +320,7 @@ discard block |
||
322 | 320 | if ($data_format === 'query') { |
323 | 321 | $url = self::format_get($url, $data); |
324 | 322 | $data = ''; |
325 | - } |
|
326 | - elseif (!is_string($data)) { |
|
323 | + } elseif (!is_string($data)) { |
|
327 | 324 | $data = http_build_query($data, null, '&'); |
328 | 325 | } |
329 | 326 | } |
@@ -361,15 +358,13 @@ discard block |
||
361 | 358 | |
362 | 359 | if (is_int($timeout) || $this->version < self::CURL_7_16_2) { |
363 | 360 | curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($timeout)); |
364 | - } |
|
365 | - else { |
|
361 | + } else { |
|
366 | 362 | curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($timeout * 1000)); |
367 | 363 | } |
368 | 364 | |
369 | 365 | if (is_int($options['connect_timeout']) || $this->version < self::CURL_7_16_2) { |
370 | 366 | curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT, ceil($options['connect_timeout'])); |
371 | - } |
|
372 | - else { |
|
367 | + } else { |
|
373 | 368 | curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT_MS, round($options['connect_timeout'] * 1000)); |
374 | 369 | } |
375 | 370 | curl_setopt($this->handle, CURLOPT_URL, $url); |
@@ -380,8 +375,7 @@ discard block |
||
380 | 375 | } |
381 | 376 | if ($options['protocol_version'] === 1.1) { |
382 | 377 | curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
383 | - } |
|
384 | - else { |
|
378 | + } else { |
|
385 | 379 | curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
386 | 380 | } |
387 | 381 | |
@@ -408,8 +402,7 @@ discard block |
||
408 | 402 | if ($options['filename'] !== false) { |
409 | 403 | fclose($this->stream_handle); |
410 | 404 | $this->headers = trim($this->headers); |
411 | - } |
|
412 | - else { |
|
405 | + } else { |
|
413 | 406 | $this->headers .= $response; |
414 | 407 | } |
415 | 408 | |
@@ -479,8 +472,7 @@ discard block |
||
479 | 472 | |
480 | 473 | if ($this->stream_handle) { |
481 | 474 | fwrite($this->stream_handle, $data); |
482 | - } |
|
483 | - else { |
|
475 | + } else { |
|
484 | 476 | $this->response_data .= $data; |
485 | 477 | } |
486 | 478 | |
@@ -500,8 +492,7 @@ discard block |
||
500 | 492 | $url_parts = parse_url($url); |
501 | 493 | if (empty($url_parts['query'])) { |
502 | 494 | $query = $url_parts['query'] = ''; |
503 | - } |
|
504 | - else { |
|
495 | + } else { |
|
505 | 496 | $query = $url_parts['query']; |
506 | 497 | } |
507 | 498 | |
@@ -510,8 +501,7 @@ discard block |
||
510 | 501 | |
511 | 502 | if (empty($url_parts['query'])) { |
512 | 503 | $url .= '?' . $query; |
513 | - } |
|
514 | - else { |
|
504 | + } else { |
|
515 | 505 | $url = str_replace($url_parts['query'], $query, $url); |
516 | 506 | } |
517 | 507 | } |