@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | $remote_socket .= ':' . $url_parts['port']; |
118 | 118 | |
119 | - set_error_handler(array($this, 'connect_error_handler'), E_WARNING | E_NOTICE); |
|
119 | + set_error_handler(array($this, 'connect_error_handler'), E_WARNING|E_NOTICE); |
|
120 | 120 | |
121 | 121 | $options['hooks']->dispatch('fsockopen.remote_socket', array(&$remote_socket)); |
122 | 122 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if (!isset($case_insensitive_headers['Host'])) { |
175 | 175 | $out .= sprintf('Host: %s', $url_parts['host']); |
176 | 176 | |
177 | - if (( 'http' === strtolower($url_parts['scheme']) && $url_parts['port'] !== 80 ) || ( 'https' === strtolower($url_parts['scheme']) && $url_parts['port'] !== 443 )) { |
|
177 | + if (('http' === strtolower($url_parts['scheme']) && $url_parts['port'] !== 80) || ('https' === strtolower($url_parts['scheme']) && $url_parts['port'] !== 443)) { |
|
178 | 178 | $out .= ':' . $url_parts['port']; |
179 | 179 | } |
180 | 180 | $out .= "\r\n"; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | return ''; |
220 | 220 | } |
221 | 221 | |
222 | - $timeout_sec = (int) floor($options['timeout']); |
|
222 | + $timeout_sec = (int)floor($options['timeout']); |
|
223 | 223 | if ($timeout_sec == $options['timeout']) { |
224 | 224 | $timeout_msec = 0; |
225 | 225 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | public function connect_error_handler($errno, $errstr) { |
380 | 380 | // Double-check we can handle it |
381 | - if (($errno & E_WARNING) === 0 && ($errno & E_NOTICE) === 0) { |
|
381 | + if (($errno&E_WARNING) === 0 && ($errno&E_NOTICE) === 0) { |
|
382 | 382 | // Return false to indicate the default error handler should engage |
383 | 383 | return false; |
384 | 384 | } |
@@ -175,8 +175,8 @@ |
||
175 | 175 | } |
176 | 176 | if (count($ipv4) === 4) { |
177 | 177 | foreach ($ipv4 as $ipv4_part) { |
178 | - $value = (int) $ipv4_part; |
|
179 | - if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF) { |
|
178 | + $value = (int)$ipv4_part; |
|
179 | + if ((string)$value !== $ipv4_part || $value < 0 || $value > 0xFF) { |
|
180 | 180 | return false; |
181 | 181 | } |
182 | 182 | } |
@@ -31,5 +31,5 @@ |
||
31 | 31 | * @see Requests_Hooks::register |
32 | 32 | * @param Requests_Hooks $hooks Hook system |
33 | 33 | */ |
34 | - public function register(Requests_Hooks &$hooks); |
|
34 | + public function register(Requests_Hooks&$hooks); |
|
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -145,26 +145,26 @@ discard block |
||
145 | 145 | $value = ord($input[$position]); |
146 | 146 | |
147 | 147 | // One byte sequence: |
148 | - if ((~$value & 0x80) === 0x80) { |
|
148 | + if ((~$value&0x80) === 0x80) { |
|
149 | 149 | $character = $value; |
150 | 150 | $length = 1; |
151 | 151 | $remaining = 0; |
152 | 152 | } |
153 | 153 | // Two byte sequence: |
154 | - elseif (($value & 0xE0) === 0xC0) { |
|
155 | - $character = ($value & 0x1F) << 6; |
|
154 | + elseif (($value&0xE0) === 0xC0) { |
|
155 | + $character = ($value&0x1F) << 6; |
|
156 | 156 | $length = 2; |
157 | 157 | $remaining = 1; |
158 | 158 | } |
159 | 159 | // Three byte sequence: |
160 | - elseif (($value & 0xF0) === 0xE0) { |
|
161 | - $character = ($value & 0x0F) << 12; |
|
160 | + elseif (($value&0xF0) === 0xE0) { |
|
161 | + $character = ($value&0x0F) << 12; |
|
162 | 162 | $length = 3; |
163 | 163 | $remaining = 2; |
164 | 164 | } |
165 | 165 | // Four byte sequence: |
166 | - elseif (($value & 0xF8) === 0xF0) { |
|
167 | - $character = ($value & 0x07) << 18; |
|
166 | + elseif (($value&0xF8) === 0xF0) { |
|
167 | + $character = ($value&0x07) << 18; |
|
168 | 168 | $length = 4; |
169 | 169 | $remaining = 3; |
170 | 170 | } |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $value = ord($input[$position]); |
182 | 182 | |
183 | 183 | // If it is invalid, count the sequence as invalid and reprocess the current byte: |
184 | - if (($value & 0xC0) !== 0x80) { |
|
184 | + if (($value&0xC0) !== 0x80) { |
|
185 | 185 | throw new Requests_Exception('Invalid Unicode codepoint', 'idna.invalidcodepoint', $character); |
186 | 186 | } |
187 | 187 | |
188 | - $character |= ($value & 0x3F) << (--$remaining * 6); |
|
188 | + $character |= ($value&0x3F) << (--$remaining * 6); |
|
189 | 189 | } |
190 | 190 | $position--; |
191 | 191 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | || $length > 3 && $character <= 0xFFFF |
198 | 198 | // Outside of range of ucschar codepoints |
199 | 199 | // Noncharacters |
200 | - || ($character & 0xFFFE) === 0xFFFE |
|
200 | + || ($character&0xFFFE) === 0xFFFE |
|
201 | 201 | || $character >= 0xFDD0 && $character <= 0xFDEF |
202 | 202 | || ( |
203 | 203 | // Everything else not in ucschar |
@@ -442,20 +442,20 @@ discard block |
||
442 | 442 | |
443 | 443 | // No one byte sequences are valid due to the while. |
444 | 444 | // Two byte sequence: |
445 | - if (($value & 0xE0) === 0xC0) { |
|
446 | - $character = ($value & 0x1F) << 6; |
|
445 | + if (($value&0xE0) === 0xC0) { |
|
446 | + $character = ($value&0x1F) << 6; |
|
447 | 447 | $length = 2; |
448 | 448 | $remaining = 1; |
449 | 449 | } |
450 | 450 | // Three byte sequence: |
451 | - elseif (($value & 0xF0) === 0xE0) { |
|
452 | - $character = ($value & 0x0F) << 12; |
|
451 | + elseif (($value&0xF0) === 0xE0) { |
|
452 | + $character = ($value&0x0F) << 12; |
|
453 | 453 | $length = 3; |
454 | 454 | $remaining = 2; |
455 | 455 | } |
456 | 456 | // Four byte sequence: |
457 | - elseif (($value & 0xF8) === 0xF0) { |
|
458 | - $character = ($value & 0x07) << 18; |
|
457 | + elseif (($value&0xF8) === 0xF0) { |
|
458 | + $character = ($value&0x07) << 18; |
|
459 | 459 | $length = 4; |
460 | 460 | $remaining = 3; |
461 | 461 | } |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | $value = ord($string[$position]); |
473 | 473 | |
474 | 474 | // Check that the byte is valid, then add it to the character: |
475 | - if (($value & 0xC0) === 0x80) { |
|
476 | - $character |= ($value & 0x3F) << (--$remaining * 6); |
|
475 | + if (($value&0xC0) === 0x80) { |
|
476 | + $character |= ($value&0x3F) << (--$remaining * 6); |
|
477 | 477 | } |
478 | 478 | // If it is invalid, count the sequence as invalid and reprocess the current byte: |
479 | 479 | else { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | || $length > 3 && $character <= 0xFFFF |
500 | 500 | // Outside of range of ucschar codepoints |
501 | 501 | // Noncharacters |
502 | - || ($character & 0xFFFE) === 0xFFFE |
|
502 | + || ($character&0xFFFE) === 0xFFFE |
|
503 | 503 | || $character >= 0xFDD0 && $character <= 0xFDEF |
504 | 504 | || ( |
505 | 505 | // Everything else not in ucschar |
@@ -569,20 +569,20 @@ discard block |
||
569 | 569 | $length = 1; |
570 | 570 | } |
571 | 571 | // Two byte sequence: |
572 | - elseif (($value & 0xE0) === 0xC0) { |
|
573 | - $character = ($value & 0x1F) << 6; |
|
572 | + elseif (($value&0xE0) === 0xC0) { |
|
573 | + $character = ($value&0x1F) << 6; |
|
574 | 574 | $length = 2; |
575 | 575 | $remaining = 1; |
576 | 576 | } |
577 | 577 | // Three byte sequence: |
578 | - elseif (($value & 0xF0) === 0xE0) { |
|
579 | - $character = ($value & 0x0F) << 12; |
|
578 | + elseif (($value&0xF0) === 0xE0) { |
|
579 | + $character = ($value&0x0F) << 12; |
|
580 | 580 | $length = 3; |
581 | 581 | $remaining = 2; |
582 | 582 | } |
583 | 583 | // Four byte sequence: |
584 | - elseif (($value & 0xF8) === 0xF0) { |
|
585 | - $character = ($value & 0x07) << 18; |
|
584 | + elseif (($value&0xF8) === 0xF0) { |
|
585 | + $character = ($value&0x07) << 18; |
|
586 | 586 | $length = 4; |
587 | 587 | $remaining = 3; |
588 | 588 | } |
@@ -595,9 +595,9 @@ discard block |
||
595 | 595 | // Continuation byte: |
596 | 596 | else { |
597 | 597 | // Check that the byte is valid, then add it to the character: |
598 | - if (($value & 0xC0) === 0x80) { |
|
598 | + if (($value&0xC0) === 0x80) { |
|
599 | 599 | $remaining--; |
600 | - $character |= ($value & 0x3F) << ($remaining * 6); |
|
600 | + $character |= ($value&0x3F) << ($remaining * 6); |
|
601 | 601 | } |
602 | 602 | // If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence: |
603 | 603 | else { |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | || $character < 0x2D |
622 | 622 | || $character > 0xEFFFD |
623 | 623 | // Noncharacters |
624 | - || ($character & 0xFFFE) === 0xFFFE |
|
624 | + || ($character&0xFFFE) === 0xFFFE |
|
625 | 625 | || $character >= 0xFDD0 && $character <= 0xFDEF |
626 | 626 | // Everything else not in iunreserved (this is all BMP) |
627 | 627 | || $character === 0x2F |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | return $return; |
732 | 732 | } |
733 | 733 | |
734 | - $parsed = $this->parse_iri((string) $iri); |
|
734 | + $parsed = $this->parse_iri((string)$iri); |
|
735 | 735 | |
736 | 736 | $return = $this->set_scheme($parsed['scheme']) |
737 | 737 | && $this->set_authority($parsed['authority']) |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | } |
910 | 910 | |
911 | 911 | if (strspn($port, '0123456789') === strlen($port)) { |
912 | - $this->port = (int) $port; |
|
912 | + $this->port = (int)$port; |
|
913 | 913 | $this->scheme_normalization(); |
914 | 914 | return true; |
915 | 915 | } |
@@ -930,10 +930,10 @@ discard block |
||
930 | 930 | $cache = array(); |
931 | 931 | } |
932 | 932 | |
933 | - $ipath = (string) $ipath; |
|
933 | + $ipath = (string)$ipath; |
|
934 | 934 | |
935 | 935 | if (isset($cache[$ipath])) { |
936 | - $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)]; |
|
936 | + $this->ipath = $cache[$ipath][(int)($this->scheme !== null)]; |
|
937 | 937 | } |
938 | 938 | else { |
939 | 939 | $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/'); |
@@ -53,7 +53,7 @@ |
||
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 | } |
@@ -277,7 +277,7 @@ |
||
277 | 277 | return null; |
278 | 278 | } |
279 | 279 | |
280 | - $delta_seconds = (int) $value; |
|
280 | + $delta_seconds = (int)$value; |
|
281 | 281 | if ($delta_seconds <= 0) { |
282 | 282 | $expiry_time = 0; |
283 | 283 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | * @return string Default certificate path. |
534 | 534 | */ |
535 | 535 | public static function get_certificate_path() { |
536 | - if ( ! empty( Requests::$certificate_path ) ) { |
|
536 | + if (!empty(Requests::$certificate_path)) { |
|
537 | 537 | return Requests::$certificate_path; |
538 | 538 | } |
539 | 539 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @param string $path Certificate path, pointing to a PEM file. |
547 | 547 | */ |
548 | - public static function set_certificate_path( $path ) { |
|
548 | + public static function set_certificate_path($path) { |
|
549 | 549 | Requests::$certificate_path = $path; |
550 | 550 | } |
551 | 551 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | if (empty($matches)) { |
656 | 656 | throw new Requests_Exception('Response could not be parsed', 'noversion', $headers); |
657 | 657 | } |
658 | - $return->protocol_version = (float) $matches[1]; |
|
659 | - $return->status_code = (int) $matches[2]; |
|
658 | + $return->protocol_version = (float)$matches[1]; |
|
659 | + $return->status_code = (int)$matches[2]; |
|
660 | 660 | if ($return->status_code >= 200 && $return->status_code < 300) { |
661 | 661 | $return->success = true; |
662 | 662 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $encoded = $data; |
760 | 760 | |
761 | 761 | while (true) { |
762 | - $is_chunked = (bool) preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); |
|
762 | + $is_chunked = (bool)preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); |
|
763 | 763 | if (!$is_chunked) { |
764 | 764 | // Looks like it's not chunked after all |
765 | 765 | return $data; |
@@ -869,17 +869,17 @@ discard block |
||
869 | 869 | $i = 10; |
870 | 870 | $flg = ord(substr($gzData, 3, 1)); |
871 | 871 | if ($flg > 0) { |
872 | - if ($flg & 4) { |
|
872 | + if ($flg&4) { |
|
873 | 873 | list($xlen) = unpack('v', substr($gzData, $i, 2)); |
874 | 874 | $i = $i + 2 + $xlen; |
875 | 875 | } |
876 | - if ($flg & 8) { |
|
876 | + if ($flg&8) { |
|
877 | 877 | $i = strpos($gzData, "\0", $i) + 1; |
878 | 878 | } |
879 | - if ($flg & 16) { |
|
879 | + if ($flg&16) { |
|
880 | 880 | $i = strpos($gzData, "\0", $i) + 1; |
881 | 881 | } |
882 | - if ($flg & 2) { |
|
882 | + if ($flg&2) { |
|
883 | 883 | $i = $i + 2; |
884 | 884 | } |
885 | 885 | } |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // If the file has been compressed on the fly, 0x08 bit is set of |
928 | 928 | // the general purpose field. We can use this to differentiate |
929 | 929 | // between a compressed document, and a ZIP file |
930 | - $zip_compressed_on_the_fly = (0x08 == (0x08 & $general_purpose_flag)); |
|
930 | + $zip_compressed_on_the_fly = (0x08 == (0x08&$general_purpose_flag)); |
|
931 | 931 | |
932 | 932 | if (!$zip_compressed_on_the_fly) { |
933 | 933 | // Don't attempt to decode a compressed zip file |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function setAncestor($ancestor) |
35 | 35 | { |
36 | - if(isset($ancestor) && $ancestor != "") |
|
36 | + if (isset($ancestor) && $ancestor != "") |
|
37 | 37 | { |
38 | 38 | $this->ancestor = $ancestor; |
39 | 39 | } |