Completed
Push — master ( 16e812...ea693b )
by mains
02:48
created
php/Requests/libary/Requests/Exception/HTTP/Unknown.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	 * @param mixed $data Associated data
36 36
 	 */
37 37
 	public function __construct($reason = null, $data = null) {
38
-		if ($data instanceof Requests_Response) {
38
+		if($data instanceof Requests_Response) {
39 39
 			$this->code = $data->status_code;
40 40
 		}
41 41
 
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Hooks.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	 * @param int $priority Priority number. <0 is executed earlier, >0 is executed later
36 36
 	 */
37 37
 	public function register($hook, $callback, $priority = 0) {
38
-		if (!isset($this->hooks[$hook])) {
38
+		if(!isset($this->hooks[$hook])) {
39 39
 			$this->hooks[$hook] = array();
40 40
 		}
41
-		if (!isset($this->hooks[$hook][$priority])) {
41
+		if(!isset($this->hooks[$hook][$priority])) {
42 42
 			$this->hooks[$hook][$priority] = array();
43 43
 		}
44 44
 
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return boolean Successfulness
54 54
 	 */
55 55
 	public function dispatch($hook, $parameters = array()) {
56
-		if (empty($this->hooks[$hook])) {
56
+		if(empty($this->hooks[$hook])) {
57 57
 			return false;
58 58
 		}
59 59
 
60
-		foreach ($this->hooks[$hook] as $priority => $hooked) {
61
-			foreach ($hooked as $callback) {
60
+		foreach($this->hooks[$hook] as $priority => $hooked) {
61
+			foreach($hooked as $callback) {
62 62
 				call_user_func_array($callback, $parameters);
63 63
 			}
64 64
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/SSL.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	public static function verify_certificate($host, $cert) {
33 33
 		// Calculate the valid wildcard match if the host is not an IP address
34 34
 		$parts = explode('.', $host);
35
-		if (ip2long($host) === false) {
35
+		if(ip2long($host) === false) {
36 36
 			$parts[0] = '*';
37 37
 		}
38 38
 		$wildcard = implode('.', $parts);
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
 		$has_dns_alt = false;
41 41
 
42 42
 		// Check the subjectAltName
43
-		if (!empty($cert['extensions']) && !empty($cert['extensions']['subjectAltName'])) {
43
+		if(!empty($cert['extensions']) && !empty($cert['extensions']['subjectAltName'])) {
44 44
 			$altnames = explode(',', $cert['extensions']['subjectAltName']);
45
-			foreach ($altnames as $altname) {
45
+			foreach($altnames as $altname) {
46 46
 				$altname = trim($altname);
47
-				if (strpos($altname, 'DNS:') !== 0) {
47
+				if(strpos($altname, 'DNS:') !== 0) {
48 48
 					continue;
49 49
 				}
50 50
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 				$altname = trim(substr($altname, 4));
55 55
 
56 56
 				// Check for a match
57
-				if (self::match_domain($host, $altname) === true) {
57
+				if(self::match_domain($host, $altname) === true) {
58 58
 					return true;
59 59
 				}
60 60
 			}
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Fall back to checking the common name if we didn't get any dNSName
64 64
 		// alt names, as per RFC2818
65
-		if (!$has_dns_alt && !empty($cert['subject']['CN'])) {
65
+		if(!$has_dns_alt && !empty($cert['subject']['CN'])) {
66 66
 			// Check for a match
67
-			if (self::match_domain($host, $cert['subject']['CN']) === true) {
67
+			if(self::match_domain($host, $cert['subject']['CN']) === true) {
68 68
 				return true;
69 69
 			}
70 70
 		}
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
 		// Check the first part of the name
95 95
 		$first = array_shift($parts);
96 96
 
97
-		if (strpos($first, '*') !== false) {
97
+		if(strpos($first, '*') !== false) {
98 98
 			// Check that the wildcard is the full part
99
-			if ($first !== '*') {
99
+			if($first !== '*') {
100 100
 				return false;
101 101
 			}
102 102
 
103 103
 			// Check that we have at least 3 components (including first)
104
-			if (count($parts) < 2) {
104
+			if(count($parts) < 2) {
105 105
 				return false;
106 106
 			}
107 107
 		}
108 108
 
109 109
 		// Check the remaining parts
110
-		foreach ($parts as $part) {
111
-			if (strpos($part, '*') !== false) {
110
+		foreach($parts as $part) {
111
+			if(strpos($part, '*') !== false) {
112 112
 				return false;
113 113
 			}
114 114
 		}
@@ -126,23 +126,23 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public static function match_domain($host, $reference) {
128 128
 		// Check if the reference is blacklisted first
129
-		if (self::verify_reference_name($reference) !== true) {
129
+		if(self::verify_reference_name($reference) !== true) {
130 130
 			return false;
131 131
 		}
132 132
 
133 133
 		// Check for a direct match
134
-		if ($host === $reference) {
134
+		if($host === $reference) {
135 135
 			return true;
136 136
 		}
137 137
 
138 138
 		// Calculate the valid wildcard match if the host is not an IP address
139 139
 		// Also validates that the host has 3 parts or more, as per Firefox's
140 140
 		// ruleset.
141
-		if (ip2long($host) === false) {
141
+		if(ip2long($host) === false) {
142 142
 			$parts = explode('.', $host);
143 143
 			$parts[0] = '*';
144 144
 			$wildcard = implode('.', $parts);
145
-			if ($wildcard === $reference) {
145
+			if($wildcard === $reference) {
146 146
 				return true;
147 147
 			}
148 148
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/IPv6.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,28 +35,28 @@  discard block
 block discarded – undo
35 35
 	 * @return string The uncompressed IPv6 address
36 36
 	 */
37 37
 	public static function uncompress($ip) {
38
-		if (substr_count($ip, '::') !== 1) {
38
+		if(substr_count($ip, '::') !== 1) {
39 39
 			return $ip;
40 40
 		}
41 41
 
42 42
 		list($ip1, $ip2) = explode('::', $ip);
43
-		$c1 = ($ip1 === '') ? -1 : substr_count($ip1, ':');
44
-		$c2 = ($ip2 === '') ? -1 : substr_count($ip2, ':');
43
+		$c1 = ($ip1 === '')? -1 : substr_count($ip1, ':');
44
+		$c2 = ($ip2 === '')? -1 : substr_count($ip2, ':');
45 45
 
46
-		if (strpos($ip2, '.') !== false) {
46
+		if(strpos($ip2, '.') !== false) {
47 47
 			$c2++;
48 48
 		}
49 49
 		// ::
50
-		if ($c1 === -1 && $c2 === -1) {
50
+		if($c1 === -1 && $c2 === -1) {
51 51
 			$ip = '0:0:0:0:0:0:0:0';
52 52
 		}
53 53
 		// ::xxx
54
-		else if ($c1 === -1) {
54
+		else if($c1 === -1) {
55 55
 			$fill = str_repeat('0:', 7 - $c2);
56 56
 			$ip = str_replace('::', $fill, $ip);
57 57
 		}
58 58
 		// xxx::
59
-		else if ($c2 === -1) {
59
+		else if($c2 === -1) {
60 60
 			$fill = str_repeat(':0', 7 - $c1);
61 61
 			$ip = str_replace('::', $fill, $ip);
62 62
 		}
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 		$ip_parts[0] = preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]);
92 92
 
93 93
 		// Find bunches of zeros
94
-		if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE)) {
94
+		if(preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE)) {
95 95
 			$max = 0;
96 96
 			$pos = null;
97
-			foreach ($matches[0] as $match) {
98
-				if (strlen($match[0]) > $max) {
97
+			foreach($matches[0] as $match) {
98
+				if(strlen($match[0]) > $max) {
99 99
 					$max = strlen($match[0]);
100 100
 					$pos = $match[1];
101 101
 				}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			$ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max);
105 105
 		}
106 106
 
107
-		if ($ip_parts[1] !== '') {
107
+		if($ip_parts[1] !== '') {
108 108
 			return implode(':', $ip_parts);
109 109
 		}
110 110
 		else {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @return string[] [0] contains the IPv6 represented part, and [1] the IPv4 represented part
126 126
 	 */
127 127
 	protected static function split_v6_v4($ip) {
128
-		if (strpos($ip, '.') !== false) {
128
+		if(strpos($ip, '.') !== false) {
129 129
 			$pos = strrpos($ip, ':');
130 130
 			$ipv6_part = substr($ip, 0, $pos);
131 131
 			$ipv4_part = substr($ip, $pos + 1);
@@ -149,34 +149,34 @@  discard block
 block discarded – undo
149 149
 		list($ipv6, $ipv4) = self::split_v6_v4($ip);
150 150
 		$ipv6 = explode(':', $ipv6);
151 151
 		$ipv4 = explode('.', $ipv4);
152
-		if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) {
153
-			foreach ($ipv6 as $ipv6_part) {
152
+		if(count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) {
153
+			foreach($ipv6 as $ipv6_part) {
154 154
 				// The section can't be empty
155
-				if ($ipv6_part === '') {
155
+				if($ipv6_part === '') {
156 156
 					return false;
157 157
 				}
158 158
 
159 159
 				// Nor can it be over four characters
160
-				if (strlen($ipv6_part) > 4) {
160
+				if(strlen($ipv6_part) > 4) {
161 161
 					return false;
162 162
 				}
163 163
 
164 164
 				// Remove leading zeros (this is safe because of the above)
165 165
 				$ipv6_part = ltrim($ipv6_part, '0');
166
-				if ($ipv6_part === '') {
166
+				if($ipv6_part === '') {
167 167
 					$ipv6_part = '0';
168 168
 				}
169 169
 
170 170
 				// Check the value is valid
171 171
 				$value = hexdec($ipv6_part);
172
-				if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) {
172
+				if(dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) {
173 173
 					return false;
174 174
 				}
175 175
 			}
176
-			if (count($ipv4) === 4) {
177
-				foreach ($ipv4 as $ipv4_part) {
178
-					$value = (int) $ipv4_part;
179
-					if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF) {
176
+			if(count($ipv4) === 4) {
177
+				foreach($ipv4 as $ipv4_part) {
178
+					$value = (int)$ipv4_part;
179
+					if((string)$value !== $ipv4_part || $value < 0 || $value > 0xFF) {
180 180
 						return false;
181 181
 					}
182 182
 				}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Response/Headers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function offsetGet($key) {
27 27
 		$key = strtolower($key);
28
-		if (!isset($this->data[$key])) {
28
+		if(!isset($this->data[$key])) {
29 29
 			return null;
30 30
 		}
31 31
 
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 	 * @param string $value Item value
42 42
 	 */
43 43
 	public function offsetSet($key, $value) {
44
-		if ($key === null) {
44
+		if($key === null) {
45 45
 			throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
46 46
 		}
47 47
 
48 48
 		$key = strtolower($key);
49 49
 
50
-		if (!isset($this->data[$key])) {
50
+		if(!isset($this->data[$key])) {
51 51
 			$this->data[$key] = array();
52 52
 		}
53 53
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function getValues($key) {
64 64
 		$key = strtolower($key);
65
-		if (!isset($this->data[$key])) {
65
+		if(!isset($this->data[$key])) {
66 66
 			return null;
67 67
 		}
68 68
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string Flattened value
80 80
 	 */
81 81
 	public function flatten($value) {
82
-		if (is_array($value)) {
82
+		if(is_array($value)) {
83 83
 			$value = implode(',', $value);
84 84
 		}
85 85
 
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Response.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -108,12 +108,12 @@
 block discarded – undo
108 108
 	 * @param boolean $allow_redirects Set to false to throw on a 3xx as well
109 109
 	 */
110 110
 	public function throw_for_status($allow_redirects = true) {
111
-		if ($this->is_redirect()) {
112
-			if (!$allow_redirects) {
111
+		if($this->is_redirect()) {
112
+			if(!$allow_redirects) {
113 113
 				throw new Requests_Exception('Redirection not allowed', 'response.no_redirects', $this);
114 114
 			}
115 115
 		}
116
-		elseif (!$this->success) {
116
+		elseif(!$this->success) {
117 117
 			$exception = Requests_Exception_HTTP::get_class($this->status_code);
118 118
 			throw new $exception(null, $this);
119 119
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/IDNAEncoder.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function encode($string) {
44 44
 		$parts = explode('.', $string);
45
-		foreach ($parts as &$part) {
45
+		foreach($parts as &$part) {
46 46
 			$part = self::to_ascii($part);
47 47
 		}
48 48
 		return implode('.', $parts);
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public static function to_ascii($string) {
63 63
 		// Step 1: Check if the string is already ASCII
64
-		if (self::is_ascii($string)) {
64
+		if(self::is_ascii($string)) {
65 65
 			// Skip to step 7
66
-			if (strlen($string) < 64) {
66
+			if(strlen($string) < 64) {
67 67
 				return $string;
68 68
 			}
69 69
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 
76 76
 		// Step 3: UseSTD3ASCIIRules is false, continue
77 77
 		// Step 4: Check if it's ASCII now
78
-		if (self::is_ascii($string)) {
78
+		if(self::is_ascii($string)) {
79 79
 			// Skip to step 7
80
-			if (strlen($string) < 64) {
80
+			if(strlen($string) < 64) {
81 81
 				return $string;
82 82
 			}
83 83
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 
87 87
 		// Step 5: Check ACE prefix
88
-		if (strpos($string, self::ACE_PREFIX) === 0) {
88
+		if(strpos($string, self::ACE_PREFIX) === 0) {
89 89
 			throw new Requests_Exception('Provided string begins with ACE prefix', 'idna.provided_is_prefixed', $string);
90 90
 		}
91 91
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$string = self::ACE_PREFIX . $string;
97 97
 
98 98
 		// Step 8: Check size
99
-		if (strlen($string) < 64) {
99
+		if(strlen($string) < 64) {
100 100
 			return $string;
101 101
 		}
102 102
 
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
 		// Get number of bytes
142 142
 		$strlen = strlen($input);
143 143
 
144
-		for ($position = 0; $position < $strlen; $position++) {
144
+		for($position = 0; $position < $strlen; $position++) {
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
 			}
@@ -173,31 +173,31 @@  discard block
 block discarded – undo
173 173
 				throw new Requests_Exception('Invalid Unicode codepoint', 'idna.invalidcodepoint', $value);
174 174
 			}
175 175
 
176
-			if ($remaining > 0) {
177
-				if ($position + $length > $strlen) {
176
+			if($remaining > 0) {
177
+				if($position + $length > $strlen) {
178 178
 					throw new Requests_Exception('Invalid Unicode codepoint', 'idna.invalidcodepoint', $character);
179 179
 				}
180
-				for ($position++; $remaining > 0; $position++) {
180
+				for($position++; $remaining > 0; $position++) {
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
 			}
192 192
 
193
-			if (
193
+			if(
194 194
 				// Non-shortest form sequences are invalid
195 195
 				   $length > 1 && $character <= 0x7F
196 196
 				|| $length > 2 && $character <= 0x7FF
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
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 		$codepoints = self::utf8_to_codepoints($input);
240 240
 		$extended = array();
241 241
 
242
-		foreach ($codepoints as $char) {
243
-			if ($char < 128) {
242
+		foreach($codepoints as $char) {
243
+			if($char < 128) {
244 244
 				// Character is valid ASCII
245 245
 				// TODO: this should also check if it's valid for a URL
246 246
 				$output .= chr($char);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			// Check if the character is non-ASCII, but below initial n
250 250
 			// This never occurs for Punycode, so ignore in coverage
251 251
 			// @codeCoverageIgnoreStart
252
-			elseif ($char < $n) {
252
+			elseif($char < $n) {
253 253
 				throw new Requests_Exception('Invalid character', 'idna.character_outside_domain', $char);
254 254
 			}
255 255
 			// @codeCoverageIgnoreEnd
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
 		sort($extended);
262 262
 		$b = $h;
263 263
 #		[copy them] followed by a delimiter if b > 0
264
-		if (strlen($output) > 0) {
264
+		if(strlen($output) > 0) {
265 265
 			$output .= '-';
266 266
 		}
267 267
 #		{if the input contains a non-basic code point < n then fail}
268 268
 #		while h < length(input) do begin
269
-		while ($h < count($codepoints)) {
269
+		while($h < count($codepoints)) {
270 270
 #			let m = the minimum code point >= n in the input
271 271
 			$m = array_shift($extended);
272 272
 			//printf('next code point to insert is %s' . PHP_EOL, dechex($m));
@@ -275,31 +275,31 @@  discard block
 block discarded – undo
275 275
 #			let n = m
276 276
 			$n = $m;
277 277
 #			for each code point c in the input (in order) do begin
278
-			for ($num = 0; $num < count($codepoints); $num++) {
278
+			for($num = 0; $num < count($codepoints); $num++) {
279 279
 				$c = $codepoints[$num];
280 280
 #				if c < n then increment delta, fail on overflow
281
-				if ($c < $n) {
281
+				if($c < $n) {
282 282
 					$delta++;
283 283
 				}
284 284
 #				if c == n then begin
285
-				elseif ($c === $n) {
285
+				elseif($c === $n) {
286 286
 #					let q = delta
287 287
 					$q = $delta;
288 288
 #					for k = base to infinity in steps of base do begin
289
-					for ($k = self::BOOTSTRAP_BASE; ; $k += self::BOOTSTRAP_BASE) {
289
+					for($k = self::BOOTSTRAP_BASE; ; $k += self::BOOTSTRAP_BASE) {
290 290
 #						let t = tmin if k <= bias {+ tmin}, or
291 291
 #								tmax if k >= bias + tmax, or k - bias otherwise
292
-						if ($k <= ($bias + self::BOOTSTRAP_TMIN)) {
292
+						if($k <= ($bias + self::BOOTSTRAP_TMIN)) {
293 293
 							$t = self::BOOTSTRAP_TMIN;
294 294
 						}
295
-						elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) {
295
+						elseif($k >= ($bias + self::BOOTSTRAP_TMAX)) {
296 296
 							$t = self::BOOTSTRAP_TMAX;
297 297
 						}
298 298
 						else {
299 299
 							$t = $k - $bias;
300 300
 						}
301 301
 #						if q < t then break
302
-						if ($q < $t) {
302
+						if($q < $t) {
303 303
 							break;
304 304
 						}
305 305
 #						output the code point for digit t + ((q - t) mod (base - t))
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	protected static function digit_to_char($digit) {
343 343
 		// @codeCoverageIgnoreStart
344 344
 		// As far as I know, this never happens, but still good to be sure.
345
-		if ($digit < 0 || $digit > 35) {
345
+		if($digit < 0 || $digit > 35) {
346 346
 			throw new Requests_Exception(sprintf('Invalid digit %d', $digit), 'idna.invalid_digit', $digit);
347 347
 		}
348 348
 		// @codeCoverageIgnoreEnd
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	protected static function adapt($delta, $numpoints, $firsttime) {
363 363
 #	function adapt(delta,numpoints,firsttime):
364 364
 #		if firsttime then let delta = delta div damp
365
-		if ($firsttime) {
365
+		if($firsttime) {
366 366
 			$delta = floor($delta / self::BOOTSTRAP_DAMP);
367 367
 		}
368 368
 #		else let delta = delta div 2
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 		$k = 0;
376 376
 #		while delta > ((base - tmin) * tmax) div 2 do begin
377 377
 		$max = floor(((self::BOOTSTRAP_BASE - self::BOOTSTRAP_TMIN) * self::BOOTSTRAP_TMAX) / 2);
378
-		while ($delta > $max) {
378
+		while($delta > $max) {
379 379
 #			let delta = delta div (base - tmin)
380 380
 			$delta = floor($delta / (self::BOOTSTRAP_BASE - self::BOOTSTRAP_TMIN));
381 381
 #			let k = k + base
Please login to merge, or discard this patch.
php/Requests/libary/Requests/IRI.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 * @param mixed $value Property value
154 154
 	 */
155 155
 	public function __set($name, $value) {
156
-		if (method_exists($this, 'set_' . $name)) {
156
+		if(method_exists($this, 'set_' . $name)) {
157 157
 			call_user_func(array($this, 'set_' . $name), $value);
158 158
 		}
159
-		elseif (
159
+		elseif(
160 160
 			   $name === 'iauthority'
161 161
 			|| $name === 'iuserinfo'
162 162
 			|| $name === 'ihost'
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		// Also why we use array_key_exists below instead of isset()
180 180
 		$props = get_object_vars($this);
181 181
 
182
-		if (
182
+		if(
183 183
 			$name === 'iri' ||
184 184
 			$name === 'uri' ||
185 185
 			$name === 'iauthority' ||
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
 			$method = 'get_' . $name;
189 189
 			$return = $this->$method();
190 190
 		}
191
-		elseif (array_key_exists($name, $props)) {
191
+		elseif(array_key_exists($name, $props)) {
192 192
 			$return = $this->$name;
193 193
 		}
194 194
 		// host -> ihost
195
-		elseif (($prop = 'i' . $name) && array_key_exists($prop, $props)) {
195
+		elseif(($prop = 'i' . $name) && array_key_exists($prop, $props)) {
196 196
 			$name = $prop;
197 197
 			$return = $this->$prop;
198 198
 		}
199 199
 		// ischeme -> scheme
200
-		elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props)) {
200
+		elseif(($prop = substr($name, 1)) && array_key_exists($prop, $props)) {
201 201
 			$name = $prop;
202 202
 			$return = $this->$prop;
203 203
 		}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			$return = null;
207 207
 		}
208 208
 
209
-		if ($return === null && isset($this->normalization[$this->scheme][$name])) {
209
+		if($return === null && isset($this->normalization[$this->scheme][$name])) {
210 210
 			return $this->normalization[$this->scheme][$name];
211 211
 		}
212 212
 		else {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @param string $name Property name
231 231
 	 */
232 232
 	public function __unset($name) {
233
-		if (method_exists($this, 'set_' . $name)) {
233
+		if(method_exists($this, 'set_' . $name)) {
234 234
 			call_user_func(array($this, 'set_' . $name), '');
235 235
 		}
236 236
 	}
@@ -254,25 +254,25 @@  discard block
 block discarded – undo
254 254
 	 * @return IRI|false
255 255
 	 */
256 256
 	public static function absolutize($base, $relative) {
257
-		if (!($relative instanceof Requests_IRI)) {
257
+		if(!($relative instanceof Requests_IRI)) {
258 258
 			$relative = new Requests_IRI($relative);
259 259
 		}
260
-		if (!$relative->is_valid()) {
260
+		if(!$relative->is_valid()) {
261 261
 			return false;
262 262
 		}
263
-		elseif ($relative->scheme !== null) {
263
+		elseif($relative->scheme !== null) {
264 264
 			return clone $relative;
265 265
 		}
266 266
 
267
-		if (!($base instanceof Requests_IRI)) {
267
+		if(!($base instanceof Requests_IRI)) {
268 268
 			$base = new Requests_IRI($base);
269 269
 		}
270
-		if ($base->scheme === null || !$base->is_valid()) {
270
+		if($base->scheme === null || !$base->is_valid()) {
271 271
 			return false;
272 272
 		}
273 273
 
274
-		if ($relative->get_iri() !== '') {
275
-			if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) {
274
+		if($relative->get_iri() !== '') {
275
+			if($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) {
276 276
 				$target = clone $relative;
277 277
 				$target->scheme = $base->scheme;
278 278
 			}
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
 				$target->iuserinfo = $base->iuserinfo;
283 283
 				$target->ihost = $base->ihost;
284 284
 				$target->port = $base->port;
285
-				if ($relative->ipath !== '') {
286
-					if ($relative->ipath[0] === '/') {
285
+				if($relative->ipath !== '') {
286
+					if($relative->ipath[0] === '/') {
287 287
 						$target->ipath = $relative->ipath;
288 288
 					}
289
-					elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
289
+					elseif(($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
290 290
 						$target->ipath = '/' . $relative->ipath;
291 291
 					}
292
-					elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
292
+					elseif(($last_segment = strrpos($base->ipath, '/')) !== false) {
293 293
 						$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
294 294
 					}
295 295
 					else {
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
 				}
301 301
 				else {
302 302
 					$target->ipath = $base->ipath;
303
-					if ($relative->iquery !== null) {
303
+					if($relative->iquery !== null) {
304 304
 						$target->iquery = $relative->iquery;
305 305
 					}
306
-					elseif ($base->iquery !== null) {
306
+					elseif($base->iquery !== null) {
307 307
 						$target->iquery = $base->iquery;
308 308
 					}
309 309
 				}
@@ -327,23 +327,23 @@  discard block
 block discarded – undo
327 327
 	protected function parse_iri($iri) {
328 328
 		$iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
329 329
 		$has_match = preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match);
330
-		if (!$has_match) {
330
+		if(!$has_match) {
331 331
 			throw new Requests_Exception('Cannot parse supplied IRI', 'iri.cannot_parse', $iri);
332 332
 		}
333 333
 
334
-		if ($match[1] === '') {
334
+		if($match[1] === '') {
335 335
 			$match['scheme'] = null;
336 336
 		}
337
-		if (!isset($match[3]) || $match[3] === '') {
337
+		if(!isset($match[3]) || $match[3] === '') {
338 338
 			$match['authority'] = null;
339 339
 		}
340
-		if (!isset($match[5])) {
340
+		if(!isset($match[5])) {
341 341
 			$match['path'] = '';
342 342
 		}
343
-		if (!isset($match[6]) || $match[6] === '') {
343
+		if(!isset($match[6]) || $match[6] === '') {
344 344
 			$match['query'] = null;
345 345
 		}
346
-		if (!isset($match[8]) || $match[8] === '') {
346
+		if(!isset($match[8]) || $match[8] === '') {
347 347
 			$match['fragment'] = null;
348 348
 		}
349 349
 		return $match;
@@ -357,46 +357,46 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	protected function remove_dot_segments($input) {
359 359
 		$output = '';
360
-		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') {
360
+		while(strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') {
361 361
 			// A: If the input buffer begins with a prefix of "../" or "./",
362 362
 			// then remove that prefix from the input buffer; otherwise,
363
-			if (strpos($input, '../') === 0) {
363
+			if(strpos($input, '../') === 0) {
364 364
 				$input = substr($input, 3);
365 365
 			}
366
-			elseif (strpos($input, './') === 0) {
366
+			elseif(strpos($input, './') === 0) {
367 367
 				$input = substr($input, 2);
368 368
 			}
369 369
 			// B: if the input buffer begins with a prefix of "/./" or "/.",
370 370
 			// where "." is a complete path segment, then replace that prefix
371 371
 			// with "/" in the input buffer; otherwise,
372
-			elseif (strpos($input, '/./') === 0) {
372
+			elseif(strpos($input, '/./') === 0) {
373 373
 				$input = substr($input, 2);
374 374
 			}
375
-			elseif ($input === '/.') {
375
+			elseif($input === '/.') {
376 376
 				$input = '/';
377 377
 			}
378 378
 			// C: if the input buffer begins with a prefix of "/../" or "/..",
379 379
 			// where ".." is a complete path segment, then replace that prefix
380 380
 			// with "/" in the input buffer and remove the last segment and its
381 381
 			// preceding "/" (if any) from the output buffer; otherwise,
382
-			elseif (strpos($input, '/../') === 0) {
382
+			elseif(strpos($input, '/../') === 0) {
383 383
 				$input = substr($input, 3);
384 384
 				$output = substr_replace($output, '', strrpos($output, '/'));
385 385
 			}
386
-			elseif ($input === '/..') {
386
+			elseif($input === '/..') {
387 387
 				$input = '/';
388 388
 				$output = substr_replace($output, '', strrpos($output, '/'));
389 389
 			}
390 390
 			// D: if the input buffer consists only of "." or "..", then remove
391 391
 			// that from the input buffer; otherwise,
392
-			elseif ($input === '.' || $input === '..') {
392
+			elseif($input === '.' || $input === '..') {
393 393
 				$input = '';
394 394
 			}
395 395
 			// E: move the first path segment in the input buffer to the end of
396 396
 			// the output buffer, including the initial "/" character (if any)
397 397
 			// and any subsequent characters up to, but not including, the next
398 398
 			// "/" character or the end of the input buffer
399
-			elseif (($pos = strpos($input, '/', 1)) !== false) {
399
+			elseif(($pos = strpos($input, '/', 1)) !== false) {
400 400
 				$output .= substr($input, 0, $pos);
401 401
 				$input = substr_replace($input, '', 0, $pos);
402 402
 			}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		// Now replace any bytes that aren't allowed with their pct-encoded versions
432 432
 		$position = 0;
433 433
 		$strlen = strlen($string);
434
-		while (($position += strspn($string, $extra_chars, $position)) < $strlen) {
434
+		while(($position += strspn($string, $extra_chars, $position)) < $strlen) {
435 435
 			$value = ord($string[$position]);
436 436
 
437 437
 			// Start position
@@ -442,20 +442,20 @@  discard block
 block discarded – undo
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
 			}
@@ -466,14 +466,14 @@  discard block
 block discarded – undo
466 466
 				$remaining = 0;
467 467
 			}
468 468
 
469
-			if ($remaining) {
470
-				if ($position + $length <= $strlen) {
471
-					for ($position++; $remaining; $position++) {
469
+			if($remaining) {
470
+				if($position + $length <= $strlen) {
471
+					for($position++; $remaining; $position++) {
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 {
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 			}
491 491
 
492 492
 			// Percent encode anything invalid or not in ucschar
493
-			if (
493
+			if(
494 494
 				// Invalid sequences
495 495
 				!$valid
496 496
 				// Non-shortest form sequences are invalid
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
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
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
 				)
516 516
 			) {
517 517
 				// If we were a character, pretend we weren't, but rather an error.
518
-				if ($valid) {
518
+				if($valid) {
519 519
 					$position--;
520 520
 				}
521 521
 
522
-				for ($j = $start; $j <= $position; $j++) {
522
+				for($j = $start; $j <= $position; $j++) {
523 523
 					$string = substr_replace($string, sprintf('%%%02X', ord($string[$j])), $j, 1);
524 524
 					$j += 2;
525 525
 					$position += 2;
@@ -552,11 +552,11 @@  discard block
 block discarded – undo
552 552
 		$remaining = 0;
553 553
 
554 554
 		// Loop over each and every byte, and set $value to its value
555
-		for ($i = 1, $len = count($bytes); $i < $len; $i++) {
555
+		for($i = 1, $len = count($bytes); $i < $len; $i++) {
556 556
 			$value = hexdec($bytes[$i]);
557 557
 
558 558
 			// If we're the first byte of sequence:
559
-			if (!$remaining) {
559
+			if(!$remaining) {
560 560
 				// Start position
561 561
 				$start = $i;
562 562
 
@@ -564,25 +564,25 @@  discard block
 block discarded – undo
564 564
 				$valid = true;
565 565
 
566 566
 				// One byte sequence:
567
-				if ($value <= 0x7F) {
567
+				if($value <= 0x7F) {
568 568
 					$character = $value;
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
 block discarded – undo
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 {
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
 			}
609 609
 
610 610
 			// If we've reached the end of the current byte sequence, append it to Unicode::$data
611
-			if (!$remaining) {
611
+			if(!$remaining) {
612 612
 				// Percent encode anything invalid or not in iunreserved
613
-				if (
613
+				if(
614 614
 					// Invalid sequences
615 615
 					!$valid
616 616
 					// Non-shortest form sequences are invalid
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
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
@@ -631,12 +631,12 @@  discard block
 block discarded – undo
631 631
 					|| $character > 0x7E && $character < 0xA0
632 632
 					|| $character > 0xD7FF && $character < 0xF900
633 633
 				) {
634
-					for ($j = $start; $j <= $i; $j++) {
634
+					for($j = $start; $j <= $i; $j++) {
635 635
 						$string .= '%' . strtoupper($bytes[$j]);
636 636
 					}
637 637
 				}
638 638
 				else {
639
-					for ($j = $start; $j <= $i; $j++) {
639
+					for($j = $start; $j <= $i; $j++) {
640 640
 						$string .= chr(hexdec($bytes[$j]));
641 641
 					}
642 642
 				}
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
 
646 646
 		// If we have any bytes left over they are invalid (i.e., we are
647 647
 		// mid-way through a multi-byte sequence)
648
-		if ($remaining) {
649
-			for ($j = $start; $j < $len; $j++) {
648
+		if($remaining) {
649
+			for($j = $start; $j < $len; $j++) {
650 650
 				$string .= '%' . strtoupper($bytes[$j]);
651 651
 			}
652 652
 		}
@@ -655,25 +655,25 @@  discard block
 block discarded – undo
655 655
 	}
656 656
 
657 657
 	protected function scheme_normalization() {
658
-		if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
658
+		if(isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
659 659
 			$this->iuserinfo = null;
660 660
 		}
661
-		if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) {
661
+		if(isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) {
662 662
 			$this->ihost = null;
663 663
 		}
664
-		if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) {
664
+		if(isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) {
665 665
 			$this->port = null;
666 666
 		}
667
-		if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) {
667
+		if(isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) {
668 668
 			$this->ipath = '';
669 669
 		}
670
-		if (isset($this->ihost) && empty($this->ipath)) {
670
+		if(isset($this->ihost) && empty($this->ipath)) {
671 671
 			$this->ipath = '/';
672 672
 		}
673
-		if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) {
673
+		if(isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) {
674 674
 			$this->iquery = null;
675 675
 		}
676
-		if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) {
676
+		if(isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) {
677 677
 			$this->ifragment = null;
678 678
 		}
679 679
 	}
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 	 */
687 687
 	public function is_valid() {
688 688
 		$isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
689
-		if ($this->ipath !== '' &&
689
+		if($this->ipath !== '' &&
690 690
 			(
691 691
 				$isauthority && $this->ipath[0] !== '/' ||
692 692
 				(
693 693
 					$this->scheme === null &&
694 694
 					!$isauthority &&
695 695
 					strpos($this->ipath, ':') !== false &&
696
-					(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
696
+					(strpos($this->ipath, '/') === false?true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
697 697
 				)
698 698
 			)
699 699
 		) {
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
 	 */
713 713
 	protected function set_iri($iri) {
714 714
 		static $cache;
715
-		if (!$cache) {
715
+		if(!$cache) {
716 716
 			$cache = array();
717 717
 		}
718 718
 
719
-		if ($iri === null) {
719
+		if($iri === null) {
720 720
 			return true;
721 721
 		}
722
-		if (isset($cache[$iri])) {
722
+		if(isset($cache[$iri])) {
723 723
 			list($this->scheme,
724 724
 				 $this->iuserinfo,
725 725
 				 $this->ihost,
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
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'])
@@ -758,10 +758,10 @@  discard block
 block discarded – undo
758 758
 	 * @return bool
759 759
 	 */
760 760
 	protected function set_scheme($scheme) {
761
-		if ($scheme === null) {
761
+		if($scheme === null) {
762 762
 			$this->scheme = null;
763 763
 		}
764
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
764
+		elseif(!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
765 765
 			$this->scheme = null;
766 766
 			return false;
767 767
 		}
@@ -780,17 +780,17 @@  discard block
 block discarded – undo
780 780
 	 */
781 781
 	protected function set_authority($authority) {
782 782
 		static $cache;
783
-		if (!$cache) {
783
+		if(!$cache) {
784 784
 			$cache = array();
785 785
 		}
786 786
 
787
-		if ($authority === null) {
787
+		if($authority === null) {
788 788
 			$this->iuserinfo = null;
789 789
 			$this->ihost = null;
790 790
 			$this->port = null;
791 791
 			return true;
792 792
 		}
793
-		if (isset($cache[$authority])) {
793
+		if(isset($cache[$authority])) {
794 794
 			list($this->iuserinfo,
795 795
 				 $this->ihost,
796 796
 				 $this->port,
@@ -800,16 +800,16 @@  discard block
 block discarded – undo
800 800
 		}
801 801
 
802 802
 		$remaining = $authority;
803
-		if (($iuserinfo_end = strrpos($remaining, '@')) !== false) {
803
+		if(($iuserinfo_end = strrpos($remaining, '@')) !== false) {
804 804
 			$iuserinfo = substr($remaining, 0, $iuserinfo_end);
805 805
 			$remaining = substr($remaining, $iuserinfo_end + 1);
806 806
 		}
807 807
 		else {
808 808
 			$iuserinfo = null;
809 809
 		}
810
-		if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) {
810
+		if(($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) {
811 811
 			$port = substr($remaining, $port_start + 1);
812
-			if ($port === false || $port === '') {
812
+			if($port === false || $port === '') {
813 813
 				$port = null;
814 814
 			}
815 815
 			$remaining = substr($remaining, 0, $port_start);
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 * @return bool
838 838
 	 */
839 839
 	protected function set_userinfo($iuserinfo) {
840
-		if ($iuserinfo === null) {
840
+		if($iuserinfo === null) {
841 841
 			$this->iuserinfo = null;
842 842
 		}
843 843
 		else {
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
 	 * @return bool
857 857
 	 */
858 858
 	protected function set_host($ihost) {
859
-		if ($ihost === null) {
859
+		if($ihost === null) {
860 860
 			$this->ihost = null;
861 861
 			return true;
862 862
 		}
863
-		if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
864
-			if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
863
+		if(substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
864
+			if(Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
865 865
 				$this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']';
866 866
 			}
867 867
 			else {
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 			// as that can add unescaped characters.
878 878
 			$position = 0;
879 879
 			$strlen = strlen($ihost);
880
-			while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) {
881
-				if ($ihost[$position] === '%') {
880
+			while(($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) {
881
+				if($ihost[$position] === '%') {
882 882
 					$position += 3;
883 883
 				}
884 884
 				else {
@@ -903,13 +903,13 @@  discard block
 block discarded – undo
903 903
 	 * @return bool
904 904
 	 */
905 905
 	protected function set_port($port) {
906
-		if ($port === null) {
906
+		if($port === null) {
907 907
 			$this->port = null;
908 908
 			return true;
909 909
 		}
910 910
 
911
-		if (strspn($port, '0123456789') === strlen($port)) {
912
-			$this->port = (int) $port;
911
+		if(strspn($port, '0123456789') === strlen($port)) {
912
+			$this->port = (int)$port;
913 913
 			$this->scheme_normalization();
914 914
 			return true;
915 915
 		}
@@ -926,21 +926,21 @@  discard block
 block discarded – undo
926 926
 	 */
927 927
 	protected function set_path($ipath) {
928 928
 		static $cache;
929
-		if (!$cache) {
929
+		if(!$cache) {
930 930
 			$cache = array();
931 931
 		}
932 932
 
933
-		$ipath = (string) $ipath;
933
+		$ipath = (string)$ipath;
934 934
 
935
-		if (isset($cache[$ipath])) {
936
-			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
935
+		if(isset($cache[$ipath])) {
936
+			$this->ipath = $cache[$ipath][(int)($this->scheme !== null)];
937 937
 		}
938 938
 		else {
939 939
 			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
940 940
 			$removed = $this->remove_dot_segments($valid);
941 941
 
942 942
 			$cache[$ipath] = array($valid, $removed);
943
-			$this->ipath = ($this->scheme !== null) ? $removed : $valid;
943
+			$this->ipath = ($this->scheme !== null)?$removed : $valid;
944 944
 		}
945 945
 		$this->scheme_normalization();
946 946
 		return true;
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	 * @return bool
954 954
 	 */
955 955
 	protected function set_query($iquery) {
956
-		if ($iquery === null) {
956
+		if($iquery === null) {
957 957
 			$this->iquery = null;
958 958
 		}
959 959
 		else {
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 	 * @return bool
971 971
 	 */
972 972
 	protected function set_fragment($ifragment) {
973
-		if ($ifragment === null) {
973
+		if($ifragment === null) {
974 974
 			$this->ifragment = null;
975 975
 		}
976 976
 		else {
@@ -987,18 +987,18 @@  discard block
 block discarded – undo
987 987
 	 * @return string|false URI if IRI is valid, false otherwise.
988 988
 	 */
989 989
 	protected function to_uri($string) {
990
-		if (!is_string($string)) {
990
+		if(!is_string($string)) {
991 991
 			return false;
992 992
 		}
993 993
 
994 994
 		static $non_ascii;
995
-		if (!$non_ascii) {
995
+		if(!$non_ascii) {
996 996
 			$non_ascii = implode('', range("\x80", "\xFF"));
997 997
 		}
998 998
 
999 999
 		$position = 0;
1000 1000
 		$strlen = strlen($string);
1001
-		while (($position += strcspn($string, $non_ascii, $position)) < $strlen) {
1001
+		while(($position += strcspn($string, $non_ascii, $position)) < $strlen) {
1002 1002
 			$string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1);
1003 1003
 			$position += 3;
1004 1004
 			$strlen += 2;
@@ -1013,22 +1013,22 @@  discard block
 block discarded – undo
1013 1013
 	 * @return string
1014 1014
 	 */
1015 1015
 	protected function get_iri() {
1016
-		if (!$this->is_valid()) {
1016
+		if(!$this->is_valid()) {
1017 1017
 			return false;
1018 1018
 		}
1019 1019
 
1020 1020
 		$iri = '';
1021
-		if ($this->scheme !== null) {
1021
+		if($this->scheme !== null) {
1022 1022
 			$iri .= $this->scheme . ':';
1023 1023
 		}
1024
-		if (($iauthority = $this->get_iauthority()) !== null) {
1024
+		if(($iauthority = $this->get_iauthority()) !== null) {
1025 1025
 			$iri .= '//' . $iauthority;
1026 1026
 		}
1027 1027
 		$iri .= $this->ipath;
1028
-		if ($this->iquery !== null) {
1028
+		if($this->iquery !== null) {
1029 1029
 			$iri .= '?' . $this->iquery;
1030 1030
 		}
1031
-		if ($this->ifragment !== null) {
1031
+		if($this->ifragment !== null) {
1032 1032
 			$iri .= '#' . $this->ifragment;
1033 1033
 		}
1034 1034
 
@@ -1050,18 +1050,18 @@  discard block
 block discarded – undo
1050 1050
 	 * @return string
1051 1051
 	 */
1052 1052
 	protected function get_iauthority() {
1053
-		if ($this->iuserinfo === null && $this->ihost === null && $this->port === null) {
1053
+		if($this->iuserinfo === null && $this->ihost === null && $this->port === null) {
1054 1054
 			return null;
1055 1055
 		}
1056 1056
 
1057 1057
 		$iauthority = '';
1058
-		if ($this->iuserinfo !== null) {
1058
+		if($this->iuserinfo !== null) {
1059 1059
 			$iauthority .= $this->iuserinfo . '@';
1060 1060
 		}
1061
-		if ($this->ihost !== null) {
1061
+		if($this->ihost !== null) {
1062 1062
 			$iauthority .= $this->ihost;
1063 1063
 		}
1064
-		if ($this->port !== null) {
1064
+		if($this->port !== null) {
1065 1065
 			$iauthority .= ':' . $this->port;
1066 1066
 		}
1067 1067
 		return $iauthority;
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	 */
1075 1075
 	protected function get_authority() {
1076 1076
 		$iauthority = $this->get_iauthority();
1077
-		if (is_string($iauthority)) {
1077
+		if(is_string($iauthority)) {
1078 1078
 			return $this->to_uri($iauthority);
1079 1079
 		}
1080 1080
 		else {
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Auth/Basic.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param array|null $args Array of user and password. Must have exactly two elements
38 38
 	 */
39 39
 	public function __construct($args = null) {
40
-		if (is_array($args)) {
41
-			if (count($args) !== 2) {
40
+		if(is_array($args)) {
41
+			if(count($args) !== 2) {
42 42
 				throw new Requests_Exception('Invalid number of arguments', 'authbasicbadargs');
43 43
 			}
44 44
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.