Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-includes/Requests/IRI.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * Returns false if $base is not absolute, otherwise an IRI.
251 251
 	 *
252
-	 * @param IRI|string $base (Absolute) Base IRI
252
+	 * @param string $base (Absolute) Base IRI
253 253
 	 * @param IRI|string $relative Relative IRI
254 254
 	 * @return IRI|false
255 255
 	 */
@@ -987,6 +987,7 @@  discard block
 block discarded – undo
987 987
 	 * Convert an IRI to a URI (or parts thereof)
988 988
 	 *
989 989
 	 * @param string|bool IRI to convert (or false from {@see get_iri})
990
+	 * @param false|string $string
990 991
 	 * @return string|false URI if IRI is valid, false otherwise.
991 992
 	 */
992 993
 	protected function to_uri($string) {
Please login to merge, or discard this patch.
Braces   +30 added lines, -60 removed lines patch added patch discarded remove patch
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 	public function __set($name, $value) {
156 156
 		if (method_exists($this, 'set_' . $name)) {
157 157
 			call_user_func(array($this, 'set_' . $name), $value);
158
-		}
159
-		elseif (
158
+		} elseif (
160 159
 			   $name === 'iauthority'
161 160
 			|| $name === 'iuserinfo'
162 161
 			|| $name === 'ihost'
@@ -187,8 +186,7 @@  discard block
 block discarded – undo
187 186
 		) {
188 187
 			$method = 'get_' . $name;
189 188
 			$return = $this->$method();
190
-		}
191
-		elseif (array_key_exists($name, $props)) {
189
+		} elseif (array_key_exists($name, $props)) {
192 190
 			$return = $this->$name;
193 191
 		}
194 192
 		// host -> ihost
@@ -200,16 +198,14 @@  discard block
 block discarded – undo
200 198
 		elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props)) {
201 199
 			$name = $prop;
202 200
 			$return = $this->$prop;
203
-		}
204
-		else {
201
+		} else {
205 202
 			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
206 203
 			$return = null;
207 204
 		}
208 205
 
209 206
 		if ($return === null && isset($this->normalization[$this->scheme][$name])) {
210 207
 			return $this->normalization[$this->scheme][$name];
211
-		}
212
-		else {
208
+		} else {
213 209
 			return $return;
214 210
 		}
215 211
 	}
@@ -259,8 +255,7 @@  discard block
 block discarded – undo
259 255
 		}
260 256
 		if (!$relative->is_valid()) {
261 257
 			return false;
262
-		}
263
-		elseif ($relative->scheme !== null) {
258
+		} elseif ($relative->scheme !== null) {
264 259
 			return clone $relative;
265 260
 		}
266 261
 
@@ -275,8 +270,7 @@  discard block
 block discarded – undo
275 270
 			if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) {
276 271
 				$target = clone $relative;
277 272
 				$target->scheme = $base->scheme;
278
-			}
279
-			else {
273
+			} else {
280 274
 				$target = new Requests_IRI;
281 275
 				$target->scheme = $base->scheme;
282 276
 				$target->iuserinfo = $base->iuserinfo;
@@ -285,32 +279,26 @@  discard block
 block discarded – undo
285 279
 				if ($relative->ipath !== '') {
286 280
 					if ($relative->ipath[0] === '/') {
287 281
 						$target->ipath = $relative->ipath;
288
-					}
289
-					elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
282
+					} elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
290 283
 						$target->ipath = '/' . $relative->ipath;
291
-					}
292
-					elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
284
+					} elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
293 285
 						$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
294
-					}
295
-					else {
286
+					} else {
296 287
 						$target->ipath = $relative->ipath;
297 288
 					}
298 289
 					$target->ipath = $target->remove_dot_segments($target->ipath);
299 290
 					$target->iquery = $relative->iquery;
300
-				}
301
-				else {
291
+				} else {
302 292
 					$target->ipath = $base->ipath;
303 293
 					if ($relative->iquery !== null) {
304 294
 						$target->iquery = $relative->iquery;
305
-					}
306
-					elseif ($base->iquery !== null) {
295
+					} elseif ($base->iquery !== null) {
307 296
 						$target->iquery = $base->iquery;
308 297
 					}
309 298
 				}
310 299
 				$target->ifragment = $relative->ifragment;
311 300
 			}
312
-		}
313
-		else {
301
+		} else {
314 302
 			$target = clone $base;
315 303
 			$target->ifragment = null;
316 304
 		}
@@ -362,8 +350,7 @@  discard block
 block discarded – undo
362 350
 			// then remove that prefix from the input buffer; otherwise,
363 351
 			if (strpos($input, '../') === 0) {
364 352
 				$input = substr($input, 3);
365
-			}
366
-			elseif (strpos($input, './') === 0) {
353
+			} elseif (strpos($input, './') === 0) {
367 354
 				$input = substr($input, 2);
368 355
 			}
369 356
 			// B: if the input buffer begins with a prefix of "/./" or "/.",
@@ -371,8 +358,7 @@  discard block
 block discarded – undo
371 358
 			// with "/" in the input buffer; otherwise,
372 359
 			elseif (strpos($input, '/./') === 0) {
373 360
 				$input = substr($input, 2);
374
-			}
375
-			elseif ($input === '/.') {
361
+			} elseif ($input === '/.') {
376 362
 				$input = '/';
377 363
 			}
378 364
 			// C: if the input buffer begins with a prefix of "/../" or "/..",
@@ -382,8 +368,7 @@  discard block
 block discarded – undo
382 368
 			elseif (strpos($input, '/../') === 0) {
383 369
 				$input = substr($input, 3);
384 370
 				$output = substr_replace($output, '', strrpos($output, '/'));
385
-			}
386
-			elseif ($input === '/..') {
371
+			} elseif ($input === '/..') {
387 372
 				$input = '/';
388 373
 				$output = substr_replace($output, '', strrpos($output, '/'));
389 374
 			}
@@ -399,8 +384,7 @@  discard block
 block discarded – undo
399 384
 			elseif (($pos = strpos($input, '/', 1)) !== false) {
400 385
 				$output .= substr($input, 0, $pos);
401 386
 				$input = substr_replace($input, '', 0, $pos);
402
-			}
403
-			else {
387
+			} else {
404 388
 				$output .= $input;
405 389
 				$input = '';
406 390
 			}
@@ -482,8 +466,7 @@  discard block
 block discarded – undo
482 466
 							break;
483 467
 						}
484 468
 					}
485
-				}
486
-				else {
469
+				} else {
487 470
 					$position = $strlen - 1;
488 471
 					$valid = false;
489 472
 				}
@@ -634,8 +617,7 @@  discard block
 block discarded – undo
634 617
 					for ($j = $start; $j <= $i; $j++) {
635 618
 						$string .= '%' . strtoupper($bytes[$j]);
636 619
 					}
637
-				}
638
-				else {
620
+				} else {
639 621
 					for ($j = $start; $j <= $i; $j++) {
640 622
 						$string .= chr(hexdec($bytes[$j]));
641 623
 					}
@@ -763,12 +745,10 @@  discard block
 block discarded – undo
763 745
 	protected function set_scheme($scheme) {
764 746
 		if ($scheme === null) {
765 747
 			$this->scheme = null;
766
-		}
767
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
748
+		} elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
768 749
 			$this->scheme = null;
769 750
 			return false;
770
-		}
771
-		else {
751
+		} else {
772 752
 			$this->scheme = strtolower($scheme);
773 753
 		}
774 754
 		return true;
@@ -806,8 +786,7 @@  discard block
 block discarded – undo
806 786
 		if (($iuserinfo_end = strrpos($remaining, '@')) !== false) {
807 787
 			$iuserinfo = substr($remaining, 0, $iuserinfo_end);
808 788
 			$remaining = substr($remaining, $iuserinfo_end + 1);
809
-		}
810
-		else {
789
+		} else {
811 790
 			$iuserinfo = null;
812 791
 		}
813 792
 		if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) {
@@ -816,8 +795,7 @@  discard block
 block discarded – undo
816 795
 				$port = null;
817 796
 			}
818 797
 			$remaining = substr($remaining, 0, $port_start);
819
-		}
820
-		else {
798
+		} else {
821 799
 			$port = null;
822 800
 		}
823 801
 
@@ -842,8 +820,7 @@  discard block
 block discarded – undo
842 820
 	protected function set_userinfo($iuserinfo) {
843 821
 		if ($iuserinfo === null) {
844 822
 			$this->iuserinfo = null;
845
-		}
846
-		else {
823
+		} else {
847 824
 			$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
848 825
 			$this->scheme_normalization();
849 826
 		}
@@ -866,13 +843,11 @@  discard block
 block discarded – undo
866 843
 		if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
867 844
 			if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
868 845
 				$this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']';
869
-			}
870
-			else {
846
+			} else {
871 847
 				$this->ihost = null;
872 848
 				return false;
873 849
 			}
874
-		}
875
-		else {
850
+		} else {
876 851
 			$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
877 852
 
878 853
 			// Lowercase, but ignore pct-encoded sections (as they should
@@ -883,8 +858,7 @@  discard block
 block discarded – undo
883 858
 			while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) {
884 859
 				if ($ihost[$position] === '%') {
885 860
 					$position += 3;
886
-				}
887
-				else {
861
+				} else {
888 862
 					$ihost[$position] = strtolower($ihost[$position]);
889 863
 					$position++;
890 864
 				}
@@ -937,8 +911,7 @@  discard block
 block discarded – undo
937 911
 
938 912
 		if (isset($cache[$ipath])) {
939 913
 			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
940
-		}
941
-		else {
914
+		} else {
942 915
 			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
943 916
 			$removed = $this->remove_dot_segments($valid);
944 917
 
@@ -958,8 +931,7 @@  discard block
 block discarded – undo
958 931
 	protected function set_query($iquery) {
959 932
 		if ($iquery === null) {
960 933
 			$this->iquery = null;
961
-		}
962
-		else {
934
+		} else {
963 935
 			$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
964 936
 			$this->scheme_normalization();
965 937
 		}
@@ -975,8 +947,7 @@  discard block
 block discarded – undo
975 947
 	protected function set_fragment($ifragment) {
976 948
 		if ($ifragment === null) {
977 949
 			$this->ifragment = null;
978
-		}
979
-		else {
950
+		} else {
980 951
 			$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
981 952
 			$this->scheme_normalization();
982 953
 		}
@@ -1079,8 +1050,7 @@  discard block
 block discarded – undo
1079 1050
 		$iauthority = $this->get_iauthority();
1080 1051
 		if (is_string($iauthority)) {
1081 1052
 			return $this->to_uri($iauthority);
1082
-		}
1083
-		else {
1053
+		} else {
1084 1054
 			return $iauthority;
1085 1055
 		}
1086 1056
 	}
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -153,8 +153,8 @@  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)) {
157
-			call_user_func(array($this, 'set_' . $name), $value);
156
+		if (method_exists($this, 'set_'.$name)) {
157
+			call_user_func(array($this, 'set_'.$name), $value);
158 158
 		}
159 159
 		elseif (
160 160
 			   $name === 'iauthority'
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			|| $name === 'iquery'
165 165
 			|| $name === 'ifragment'
166 166
 		) {
167
-			call_user_func(array($this, 'set_' . substr($name, 1)), $value);
167
+			call_user_func(array($this, 'set_'.substr($name, 1)), $value);
168 168
 		}
169 169
 	}
170 170
 
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 			$name === 'iauthority' ||
186 186
 			$name === 'authority'
187 187
 		) {
188
-			$method = 'get_' . $name;
188
+			$method = 'get_'.$name;
189 189
 			$return = $this->$method();
190 190
 		}
191 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
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			$return = $this->$prop;
203 203
 		}
204 204
 		else {
205
-			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
205
+			trigger_error('Undefined property: '.get_class($this).'::'.$name, E_USER_NOTICE);
206 206
 			$return = null;
207 207
 		}
208 208
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return bool
222 222
 	 */
223 223
 	public function __isset($name) {
224
-		return (method_exists($this, 'get_' . $name) || isset($this->$name));
224
+		return (method_exists($this, 'get_'.$name) || isset($this->$name));
225 225
 	}
226 226
 
227 227
 	/**
@@ -230,8 +230,8 @@  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)) {
234
-			call_user_func(array($this, 'set_' . $name), '');
233
+		if (method_exists($this, 'set_'.$name)) {
234
+			call_user_func(array($this, 'set_'.$name), '');
235 235
 		}
236 236
 	}
237 237
 
@@ -254,20 +254,20 @@  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 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
 
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 						$target->ipath = $relative->ipath;
288 288
 					}
289 289
 					elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
290
-						$target->ipath = '/' . $relative->ipath;
290
+						$target->ipath = '/'.$relative->ipath;
291 291
 					}
292 292
 					elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
293
-						$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
293
+						$target->ipath = substr($base->ipath, 0, $last_segment + 1).$relative->ipath;
294 294
 					}
295 295
 					else {
296 296
 						$target->ipath = $relative->ipath;
@@ -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 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;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 				$input = '';
406 406
 			}
407 407
 		}
408
-		return $output . $input;
408
+		return $output.$input;
409 409
 	}
410 410
 
411 411
 	/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 			// Percent encode anything invalid or not in ucschar
493 493
 			if (
494 494
 				// Invalid sequences
495
-				!$valid
495
+				! $valid
496 496
 				// Non-shortest form sequences are invalid
497 497
 				|| $length > 1 && $character <= 0x7F
498 498
 				|| $length > 2 && $character <= 0x7FF
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 				)
510 510
 				&& (
511 511
 					// Everything not in iprivate, if it applies
512
-					   !$iprivate
512
+					   ! $iprivate
513 513
 					|| $character < 0xE000
514 514
 					|| $character > 0x10FFFD
515 515
 				)
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
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
 
@@ -608,11 +608,11 @@  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 613
 				if (
614 614
 					// Invalid sequences
615
-					!$valid
615
+					! $valid
616 616
 					// Non-shortest form sequences are invalid
617 617
 					|| $length > 1 && $character <= 0x7F
618 618
 					|| $length > 2 && $character <= 0x7FF
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 					|| $character > 0xD7FF && $character < 0xF900
633 633
 				) {
634 634
 					for ($j = $start; $j <= $i; $j++) {
635
-						$string .= '%' . strtoupper($bytes[$j]);
635
+						$string .= '%'.strtoupper($bytes[$j]);
636 636
 					}
637 637
 				}
638 638
 				else {
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		// mid-way through a multi-byte sequence)
648 648
 		if ($remaining) {
649 649
 			for ($j = $start; $j < $len; $j++) {
650
-				$string .= '%' . strtoupper($bytes[$j]);
650
+				$string .= '%'.strtoupper($bytes[$j]);
651 651
 			}
652 652
 		}
653 653
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 				$isauthority && $this->ipath[0] !== '/' ||
692 692
 				(
693 693
 					$this->scheme === null &&
694
-					!$isauthority &&
694
+					! $isauthority &&
695 695
 					strpos($this->ipath, ':') !== false &&
696 696
 					(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
697 697
 				)
@@ -712,7 +712,7 @@  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
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 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,7 +780,7 @@  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
 
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 		}
863 863
 		if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
864 864
 			if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
865
-				$this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']';
865
+				$this->ihost = '['.Requests_IPv6::compress(substr($ihost, 1, -1)).']';
866 866
 			}
867 867
 			else {
868 868
 				$this->ihost = null;
@@ -926,7 +926,7 @@  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
 
@@ -987,12 +987,12 @@  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
 
@@ -1013,23 +1013,23 @@  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 1021
 		if ($this->scheme !== null) {
1022
-			$iri .= $this->scheme . ':';
1022
+			$iri .= $this->scheme.':';
1023 1023
 		}
1024 1024
 		if (($iauthority = $this->get_iauthority()) !== null) {
1025
-			$iri .= '//' . $iauthority;
1025
+			$iri .= '//'.$iauthority;
1026 1026
 		}
1027 1027
 		$iri .= $this->ipath;
1028 1028
 		if ($this->iquery !== null) {
1029
-			$iri .= '?' . $this->iquery;
1029
+			$iri .= '?'.$this->iquery;
1030 1030
 		}
1031 1031
 		if ($this->ifragment !== null) {
1032
-			$iri .= '#' . $this->ifragment;
1032
+			$iri .= '#'.$this->ifragment;
1033 1033
 		}
1034 1034
 
1035 1035
 		return $iri;
@@ -1056,13 +1056,13 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 		$iauthority = '';
1058 1058
 		if ($this->iuserinfo !== null) {
1059
-			$iauthority .= $this->iuserinfo . '@';
1059
+			$iauthority .= $this->iuserinfo.'@';
1060 1060
 		}
1061 1061
 		if ($this->ihost !== null) {
1062 1062
 			$iauthority .= $this->ihost;
1063 1063
 		}
1064 1064
 		if ($this->port !== null) {
1065
-			$iauthority .= ':' . $this->port;
1065
+			$iauthority .= ':'.$this->port;
1066 1066
 		}
1067 1067
 		return $iauthority;
1068 1068
 	}
Please login to merge, or discard this patch.
src/wp-includes/Requests/Session.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 	 *
233 233
 	 * @param array $request Request data (same form as {@see request_multiple})
234 234
 	 * @param boolean $merge_options Should we merge options as well?
235
-	 * @return array Request data
235
+	 * @return string Request data
236 236
 	 */
237 237
 	protected function merge_request($request, $merge_options = true) {
238 238
 		if ($this->url !== null) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -249,8 +249,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/wp-includes/Requests/Proxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,5 +31,5 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/wp-includes/Requests/Cookie.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 * @return boolean Whether the cookie is valid for the given URI
118 118
 	 */
119 119
 	public function uri_matches(Requests_IRI $uri) {
120
-		if (!$this->domain_matches($uri->host)) {
120
+		if ( ! $this->domain_matches($uri->host)) {
121 121
 			return false;
122 122
 		}
123 123
 
124
-		if (!$this->path_matches($uri->path)) {
124
+		if ( ! $this->path_matches($uri->path)) {
125 125
 			return false;
126 126
 		}
127 127
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return boolean Whether the cookie is valid for the given domain
136 136
 	 */
137 137
 	public function domain_matches($string) {
138
-		if (!isset($this->attributes['domain'])) {
138
+		if ( ! isset($this->attributes['domain'])) {
139 139
 			// Cookies created manually; cookies created by Requests will set
140 140
 			// the domain to the requested domain
141 141
 			return true;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		}
173 173
 
174 174
 		// The string should be a host name (i.e., not an IP address).
175
-		return !preg_match('#^(.+\.)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $string);
175
+		return ! preg_match('#^(.+\.)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $string);
176 176
 	}
177 177
 
178 178
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			$request_path = '/';
190 190
 		}
191 191
 
192
-		if (!isset($this->attributes['path'])) {
192
+		if ( ! isset($this->attributes['path'])) {
193 193
 			// Cookies created manually; cookies created by Requests will set
194 194
 			// the path to the requested path
195 195
 			return true;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 				}
274 274
 
275 275
 				// Check that we have a valid age
276
-				if (!preg_match('/^-?\d+$/', $value)) {
276
+				if ( ! preg_match('/^-?\d+$/', $value)) {
277 277
 					return null;
278 278
 				}
279 279
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public function format_for_set_cookie() {
334 334
 		$header_value = $this->format_for_header();
335
-		if (!empty($this->attributes)) {
335
+		if ( ! empty($this->attributes)) {
336 336
 			$parts = array();
337 337
 			foreach ($this->attributes as $key => $value) {
338 338
 				// Ignore non-associative attributes
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
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
 	}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		$parts = explode(';', $string);
384 384
 		$kvparts = array_shift($parts);
385 385
 
386
-		if (!empty($name)) {
386
+		if ( ! empty($name)) {
387 387
 			$value = $string;
388 388
 		}
389 389
 		elseif (strpos($kvparts, '=') === false) {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		// Attribute key are handled case-insensitively
405 405
 		$attributes = new Requests_Utility_CaseInsensitiveDictionary();
406 406
 
407
-		if (!empty($parts)) {
407
+		if ( ! empty($parts)) {
408 408
 			foreach ($parts as $part) {
409 409
 				if (strpos($part, '=') === false) {
410 410
 					$part_key = $part;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 			$parsed = self::parse($header, '', $time);
443 443
 
444 444
 			// Default domain/path attributes
445
-			if (empty($parsed->attributes['domain']) && !empty($origin)) {
445
+			if (empty($parsed->attributes['domain']) && ! empty($origin)) {
446 446
 				$parsed->attributes['domain'] = $origin->host;
447 447
 				$parsed->flags['host-only'] = true;
448 448
 			}
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 				$parsed->flags['host-only'] = false;
451 451
 			}
452 452
 
453
-			$path_is_valid = (!empty($parsed->attributes['path']) && $parsed->attributes['path'][0] === '/');
454
-			if (!$path_is_valid && !empty($origin)) {
453
+			$path_is_valid = ( ! empty($parsed->attributes['path']) && $parsed->attributes['path'][0] === '/');
454
+			if ( ! $path_is_valid && ! empty($origin)) {
455 455
 				$path = $origin->path;
456 456
 
457 457
 				// Default path normalization as per RFC 6265 section 5.1.4
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 			}
478 478
 
479 479
 			// Reject invalid cookie domains
480
-			if (!empty($origin) && !$parsed->domain_matches($origin->host)) {
480
+			if ( ! empty($origin) && ! $parsed->domain_matches($origin->host)) {
481 481
 				continue;
482 482
 			}
483 483
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -280,8 +280,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 ("/").
Please login to merge, or discard this patch.
src/wp-includes/Requests/SSL.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  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 45
 			foreach ($altnames as $altname) {
46 46
 				$altname = trim($altname);
@@ -62,7 +62,7 @@  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 67
 			if (self::match_domain($host, $cert['subject']['CN']) === true) {
68 68
 				return true;
Please login to merge, or discard this patch.
src/wp-includes/Requests/Proxy/HTTP.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,16 +57,13 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/wp-includes/Requests/Auth/Basic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -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
 	}
@@ -83,6 +83,6 @@  discard block
 block discarded – undo
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
Please login to merge, or discard this patch.
src/wp-includes/Requests/Exception/HTTP.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	 * @return string Exception class name to use
58 58
 	 */
59 59
 	public static function get_class($code) {
60
-		if (!$code) {
60
+		if ( ! $code) {
61 61
 			return 'Requests_Exception_HTTP_Unknown';
62 62
 		}
63 63
 
Please login to merge, or discard this patch.
src/wp-includes/Requests/Response.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,11 +109,11 @@
 block discarded – undo
109 109
 	 */
110 110
 	public function throw_for_status($allow_redirects = true) {
111 111
 		if ($this->is_redirect()) {
112
-			if (!$allow_redirects) {
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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.