Completed
Push — master ( 4a8418...a8d532 )
by mains
03:04
created
php/Requests/libary/Requests/Auth.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,5 +29,5 @@
 block discarded – undo
29 29
 	 * @see Requests_Hooks::register
30 30
 	 * @param Requests_Hooks $hooks Hook system
31 31
 	 */
32
-	public function register(Requests_Hooks &$hooks);
32
+	public function register(Requests_Hooks&$hooks);
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
php/Location.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Location{
3
+class Location {
4 4
 
5 5
     public $cityName;
6 6
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $this->lng = $lng;
39 39
     }
40
-    public function toArray(){
40
+    public function toArray() {
41 41
         return array(
42 42
             "city" => $this->getCityName(),
43 43
             "country" => 'DE',
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Cookie/Jar.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return Requests_Cookie
37 37
 	 */
38 38
 	public function normalize_cookie($cookie, $key = null) {
39
-		if ($cookie instanceof Requests_Cookie) {
39
+		if($cookie instanceof Requests_Cookie) {
40 40
 			return $cookie;
41 41
 		}
42 42
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return string Item value
72 72
 	 */
73 73
 	public function offsetGet($key) {
74
-		if (!isset($this->cookies[$key])) {
74
+		if(!isset($this->cookies[$key])) {
75 75
 			return null;
76 76
 		}
77 77
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param string $value Item value
88 88
 	 */
89 89
 	public function offsetSet($key, $value) {
90
-		if ($key === null) {
90
+		if($key === null) {
91 91
 			throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
92 92
 		}
93 93
 
@@ -134,21 +134,21 @@  discard block
 block discarded – undo
134 134
 	 * @param array $options
135 135
 	 */
136 136
 	public function before_request($url, &$headers, &$data, &$type, &$options) {
137
-		if (!$url instanceof Requests_IRI) {
137
+		if(!$url instanceof Requests_IRI) {
138 138
 			$url = new Requests_IRI($url);
139 139
 		}
140 140
 
141
-		if (!empty($this->cookies)) {
141
+		if(!empty($this->cookies)) {
142 142
 			$cookies = array();
143
-			foreach ($this->cookies as $key => $cookie) {
143
+			foreach($this->cookies as $key => $cookie) {
144 144
 				$cookie = $this->normalize_cookie($cookie, $key);
145 145
 
146 146
 				// Skip expired cookies
147
-				if ($cookie->is_expired()) {
147
+				if($cookie->is_expired()) {
148 148
 					continue;
149 149
 				}
150 150
 
151
-				if ($cookie->domain_matches($url->host)) {
151
+				if($cookie->domain_matches($url->host)) {
152 152
 					$cookies[] = $cookie->format_for_header();
153 153
 				}
154 154
 			}
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @var Requests_Response $response
164 164
 	 */
165
-	public function before_redirect_check(Requests_Response &$return) {
165
+	public function before_redirect_check(Requests_Response&$return) {
166 166
 		$url = $return->url;
167
-		if (!$url instanceof Requests_IRI) {
167
+		if(!$url instanceof Requests_IRI) {
168 168
 			$url = new Requests_IRI($url);
169 169
 		}
170 170
 
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Proxy/HTTP.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	 * @param array|null $args Array of user and password. Must have exactly two elements
56 56
 	 */
57 57
 	public function __construct($args = null) {
58
-		if (is_string($args)) {
58
+		if(is_string($args)) {
59 59
 			$this->proxy = $args;
60 60
 		}
61
-		elseif (is_array($args)) {
62
-			if (count($args) == 1) {
61
+		elseif(is_array($args)) {
62
+			if(count($args) == 1) {
63 63
 				list($this->proxy) = $args;
64 64
 			}
65
-			elseif (count($args) == 3) {
65
+			elseif(count($args) == 3) {
66 66
 				list($this->proxy, $this->user, $this->pass) = $args;
67 67
 				$this->use_authentication = true;
68 68
 			}
@@ -82,12 +82,12 @@  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'));
89 89
 		$hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path'));
90
-		if ($this->use_authentication) {
90
+		if($this->use_authentication) {
91 91
 			$hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
92 92
 		}
93 93
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
103 103
 		curl_setopt($handle, CURLOPT_PROXY, $this->proxy);
104 104
 
105
-		if ($this->use_authentication) {
105
+		if($this->use_authentication) {
106 106
 			curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
107 107
 			curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string());
108 108
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Transport/cURL.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 
97 97
 		curl_setopt($this->handle, CURLOPT_HEADER, false);
98 98
 		curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);
99
-		if ($this->version >= self::CURL_7_10_5) {
99
+		if($this->version >= self::CURL_7_10_5) {
100 100
 			curl_setopt($this->handle, CURLOPT_ENCODING, '');
101 101
 		}
102
-		if (defined('CURLOPT_PROTOCOLS')) {
103
-			curl_setopt($this->handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
102
+		if(defined('CURLOPT_PROTOCOLS')) {
103
+			curl_setopt($this->handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
104 104
 		}
105
-		if (defined('CURLOPT_REDIR_PROTOCOLS')) {
106
-			curl_setopt($this->handle, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
105
+		if(defined('CURLOPT_REDIR_PROTOCOLS')) {
106
+			curl_setopt($this->handle, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
107 107
 		}
108 108
 	}
109 109
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * Destructor
112 112
 	 */
113 113
 	public function __destruct() {
114
-		if (is_resource($this->handle)) {
114
+		if(is_resource($this->handle)) {
115 115
 			curl_close($this->handle);
116 116
 		}
117 117
 	}
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$options['hooks']->dispatch('curl.before_send', array(&$this->handle));
136 136
 
137
-		if ($options['filename'] !== false) {
137
+		if($options['filename'] !== false) {
138 138
 			$this->stream_handle = fopen($options['filename'], 'wb');
139 139
 		}
140 140
 
141 141
 		$this->response_data = '';
142 142
 		$this->response_bytes = 0;
143 143
 		$this->response_byte_limit = false;
144
-		if ($options['max_bytes'] !== false) {
144
+		if($options['max_bytes'] !== false) {
145 145
 			$this->response_byte_limit = $options['max_bytes'];
146 146
 		}
147 147
 
148
-		if (isset($options['verify'])) {
149
-			if ($options['verify'] === false) {
148
+		if(isset($options['verify'])) {
149
+			if($options['verify'] === false) {
150 150
 				curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, 0);
151 151
 				curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, 0);
152 152
 			}
153
-			elseif (is_string($options['verify'])) {
153
+			elseif(is_string($options['verify'])) {
154 154
 				curl_setopt($this->handle, CURLOPT_CAINFO, $options['verify']);
155 155
 			}
156 156
 		}
157 157
 
158
-		if (isset($options['verifyname']) && $options['verifyname'] === false) {
158
+		if(isset($options['verifyname']) && $options['verifyname'] === false) {
159 159
 			curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, 0);
160 160
 		}
161 161
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 		$options['hooks']->dispatch('curl.after_send', array());
166 166
 
167
-		if (curl_errno($this->handle) === 23 || curl_errno($this->handle) === 61) {
167
+		if(curl_errno($this->handle) === 23 || curl_errno($this->handle) === 61) {
168 168
 			// Reset encoding and try again
169 169
 			curl_setopt($this->handle, CURLOPT_ENCODING, 'none');
170 170
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function request_multiple($requests, $options) {
195 195
 		// If you're not requesting, we can't get any responses ¯\_(ツ)_/¯
196
-		if (empty($requests)) {
196
+		if(empty($requests)) {
197 197
 			return array();
198 198
 		}
199 199
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		$subhandles = array();
203 203
 
204 204
 		$class = get_class($this);
205
-		foreach ($requests as $id => $request) {
205
+		foreach($requests as $id => $request) {
206 206
 			$subrequests[$id] = new $class();
207 207
 			$subhandles[$id] = $subrequests[$id]->get_subrequest_handle($request['url'], $request['headers'], $request['data'], $request['options']);
208 208
 			$request['options']['hooks']->dispatch('curl.before_multi_add', array(&$subhandles[$id]));
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 			do {
221 221
 				$status = curl_multi_exec($multihandle, $active);
222 222
 			}
223
-			while ($status === CURLM_CALL_MULTI_PERFORM);
223
+			while($status === CURLM_CALL_MULTI_PERFORM);
224 224
 
225 225
 			$to_process = array();
226 226
 
227 227
 			// Read the information as needed
228
-			while ($done = curl_multi_info_read($multihandle)) {
228
+			while($done = curl_multi_info_read($multihandle)) {
229 229
 				$key = array_search($done['handle'], $subhandles, true);
230
-				if (!isset($to_process[$key])) {
230
+				if(!isset($to_process[$key])) {
231 231
 					$to_process[$key] = $done;
232 232
 				}
233 233
 			}
234 234
 
235 235
 			// Parse the finished requests before we start getting the new ones
236
-			foreach ($to_process as $key => $done) {
236
+			foreach($to_process as $key => $done) {
237 237
 				$options = $requests[$key]['options'];
238
-				if (CURLE_OK !== $done['result']) {
238
+				if(CURLE_OK !== $done['result']) {
239 239
 					//get error string for handle.
240 240
 					$reason = curl_error($done['handle']);
241 241
 					$exception = new Requests_Exception_Transport_cURL(
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 				curl_multi_remove_handle($multihandle, $done['handle']);
257 257
 				curl_close($done['handle']);
258 258
 
259
-				if (!is_string($responses[$key])) {
259
+				if(!is_string($responses[$key])) {
260 260
 					$options['hooks']->dispatch('multiple.request.complete', array(&$responses[$key], $key));
261 261
 				}
262 262
 				$completed++;
263 263
 			}
264 264
 		}
265
-		while ($active || $completed < count($subrequests));
265
+		while($active || $completed < count($subrequests));
266 266
 
267 267
 		$request['options']['hooks']->dispatch('curl.after_multi_exec', array(&$multihandle));
268 268
 
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
 	public function &get_subrequest_handle($url, $headers, $data, $options) {
284 284
 		$this->setup_handle($url, $headers, $data, $options);
285 285
 
286
-		if ($options['filename'] !== false) {
286
+		if($options['filename'] !== false) {
287 287
 			$this->stream_handle = fopen($options['filename'], 'wb');
288 288
 		}
289 289
 
290 290
 		$this->response_data = '';
291 291
 		$this->response_bytes = 0;
292 292
 		$this->response_byte_limit = false;
293
-		if ($options['max_bytes'] !== false) {
293
+		if($options['max_bytes'] !== false) {
294 294
 			$this->response_byte_limit = $options['max_bytes'];
295 295
 		}
296 296
 		$this->hooks = $options['hooks'];
@@ -310,25 +310,25 @@  discard block
 block discarded – undo
310 310
 		$options['hooks']->dispatch('curl.before_request', array(&$this->handle));
311 311
 
312 312
 		// Force closing the connection for old versions of cURL (<7.22).
313
-		if ( ! isset( $headers['Connection'] ) ) {
313
+		if(!isset($headers['Connection'])) {
314 314
 			$headers['Connection'] = 'close';
315 315
 		}
316 316
 
317 317
 		$headers = Requests::flatten($headers);
318 318
 
319
-		if (!empty($data)) {
319
+		if(!empty($data)) {
320 320
 			$data_format = $options['data_format'];
321 321
 
322
-			if ($data_format === 'query') {
322
+			if($data_format === 'query') {
323 323
 				$url = self::format_get($url, $data);
324 324
 				$data = '';
325 325
 			}
326
-			elseif (!is_string($data)) {
326
+			elseif(!is_string($data)) {
327 327
 				$data = http_build_query($data, null, '&');
328 328
 			}
329 329
 		}
330 330
 
331
-		switch ($options['type']) {
331
+		switch($options['type']) {
332 332
 			case Requests::POST:
333 333
 				curl_setopt($this->handle, CURLOPT_POST, true);
334 334
 				curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 			case Requests::OPTIONS:
347 347
 			default:
348 348
 				curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
349
-				if (!empty($data)) {
349
+				if(!empty($data)) {
350 350
 					curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
351 351
 				}
352 352
 		}
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
 		// https://github.com/curl/curl/blob/4f45240bc84a9aa648c8f7243be7b79e9f9323a5/lib/hostip.c#L606-L609
360 360
 		$timeout = max($options['timeout'], 1);
361 361
 
362
-		if (is_int($timeout) || $this->version < self::CURL_7_16_2) {
362
+		if(is_int($timeout) || $this->version < self::CURL_7_16_2) {
363 363
 			curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($timeout));
364 364
 		}
365 365
 		else {
366 366
 			curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($timeout * 1000));
367 367
 		}
368 368
 
369
-		if (is_int($options['connect_timeout']) || $this->version < self::CURL_7_16_2) {
369
+		if(is_int($options['connect_timeout']) || $this->version < self::CURL_7_16_2) {
370 370
 			curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT, ceil($options['connect_timeout']));
371 371
 		}
372 372
 		else {
@@ -375,17 +375,17 @@  discard block
 block discarded – undo
375 375
 		curl_setopt($this->handle, CURLOPT_URL, $url);
376 376
 		curl_setopt($this->handle, CURLOPT_REFERER, $url);
377 377
 		curl_setopt($this->handle, CURLOPT_USERAGENT, $options['useragent']);
378
-		if (!empty($headers)) {
378
+		if(!empty($headers)) {
379 379
 			curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers);
380 380
 		}
381
-		if ($options['protocol_version'] === 1.1) {
381
+		if($options['protocol_version'] === 1.1) {
382 382
 			curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
383 383
 		}
384 384
 		else {
385 385
 			curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
386 386
 		}
387 387
 
388
-		if (true === $options['blocking']) {
388
+		if(true === $options['blocking']) {
389 389
 			curl_setopt($this->handle, CURLOPT_HEADERFUNCTION, array(&$this, 'stream_headers'));
390 390
 			curl_setopt($this->handle, CURLOPT_WRITEFUNCTION, array(&$this, 'stream_body'));
391 391
 			curl_setopt($this->handle, CURLOPT_BUFFERSIZE, Requests::BUFFER_SIZE);
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
 	 * @return string HTTP response data including headers
401 401
 	 */
402 402
 	public function process_response($response, $options) {
403
-		if ($options['blocking'] === false) {
403
+		if($options['blocking'] === false) {
404 404
 			$fake_headers = '';
405 405
 			$options['hooks']->dispatch('curl.after_request', array(&$fake_headers));
406 406
 			return false;
407 407
 		}
408
-		if ($options['filename'] !== false) {
408
+		if($options['filename'] !== false) {
409 409
 			fclose($this->stream_handle);
410 410
 			$this->headers = trim($this->headers);
411 411
 		}
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			$this->headers .= $response;
414 414
 		}
415 415
 
416
-		if (curl_errno($this->handle)) {
416
+		if(curl_errno($this->handle)) {
417 417
 			$error = sprintf(
418 418
 				'cURL error %s: %s',
419 419
 				curl_errno($this->handle),
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 		// Why do we do this? cURL will send both the final response and any
439 439
 		// interim responses, such as a 100 Continue. We don't need that.
440 440
 		// (We may want to keep this somewhere just in case)
441
-		if ($this->done_headers) {
441
+		if($this->done_headers) {
442 442
 			$this->headers = '';
443 443
 			$this->done_headers = false;
444 444
 		}
445 445
 		$this->headers .= $headers;
446 446
 
447
-		if ($headers === "\r\n") {
447
+		if($headers === "\r\n") {
448 448
 			$this->done_headers = true;
449 449
 		}
450 450
 		return strlen($headers);
@@ -464,20 +464,20 @@  discard block
 block discarded – undo
464 464
 		$data_length = strlen($data);
465 465
 
466 466
 		// Are we limiting the response size?
467
-		if ($this->response_byte_limit) {
468
-			if ($this->response_bytes === $this->response_byte_limit) {
467
+		if($this->response_byte_limit) {
468
+			if($this->response_bytes === $this->response_byte_limit) {
469 469
 				// Already at maximum, move on
470 470
 				return $data_length;
471 471
 			}
472 472
 
473
-			if (($this->response_bytes + $data_length) > $this->response_byte_limit) {
473
+			if(($this->response_bytes + $data_length) > $this->response_byte_limit) {
474 474
 				// Limit the length
475 475
 				$limited_length = ($this->response_byte_limit - $this->response_bytes);
476 476
 				$data = substr($data, 0, $limited_length);
477 477
 			}
478 478
 		}
479 479
 
480
-		if ($this->stream_handle) {
480
+		if($this->stream_handle) {
481 481
 			fwrite($this->stream_handle, $data);
482 482
 		}
483 483
 		else {
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 	 * @return string URL with data
497 497
 	 */
498 498
 	protected static function format_get($url, $data) {
499
-		if (!empty($data)) {
499
+		if(!empty($data)) {
500 500
 			$url_parts = parse_url($url);
501
-			if (empty($url_parts['query'])) {
501
+			if(empty($url_parts['query'])) {
502 502
 				$query = $url_parts['query'] = '';
503 503
 			}
504 504
 			else {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 			$query .= '&' . http_build_query($data, null, '&');
509 509
 			$query = trim($query, '&');
510 510
 
511
-			if (empty($url_parts['query'])) {
511
+			if(empty($url_parts['query'])) {
512 512
 				$url .= '?' . $query;
513 513
 			}
514 514
 			else {
@@ -525,14 +525,14 @@  discard block
 block discarded – undo
525 525
 	 * @return boolean True if the transport is valid, false otherwise.
526 526
 	 */
527 527
 	public static function test($capabilities = array()) {
528
-		if (!function_exists('curl_init') || !function_exists('curl_exec')) {
528
+		if(!function_exists('curl_init') || !function_exists('curl_exec')) {
529 529
 			return false;
530 530
 		}
531 531
 
532 532
 		// If needed, check that our installed curl version supports SSL
533
-		if (isset($capabilities['ssl']) && $capabilities['ssl']) {
533
+		if(isset($capabilities['ssl']) && $capabilities['ssl']) {
534 534
 			$curl_version = curl_version();
535
-			if (!(CURL_VERSION_SSL & $curl_version['features'])) {
535
+			if(!(CURL_VERSION_SSL&$curl_version['features'])) {
536 536
 				return false;
537 537
 			}
538 538
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Transport/fsockopen.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$options['hooks']->dispatch('fsockopen.before_request');
60 60
 
61 61
 		$url_parts = parse_url($url);
62
-		if (empty($url_parts)) {
62
+		if(empty($url_parts)) {
63 63
 			throw new Requests_Exception('Invalid URL.', 'invalidurl', $url);
64 64
 		}
65 65
 		$host = $url_parts['host'];
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 		$case_insensitive_headers = new Requests_Utility_CaseInsensitiveDictionary($headers);
69 69
 
70 70
 		// HTTPS support
71
-		if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') {
71
+		if(isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') {
72 72
 			$remote_socket = 'ssl://' . $host;
73
-			if (!isset($url_parts['port'])) {
73
+			if(!isset($url_parts['port'])) {
74 74
 				$url_parts['port'] = 443;
75 75
 			}
76 76
 
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 			$verifyname = true;
83 83
 
84 84
 			// SNI, if enabled (OpenSSL >=0.9.8j)
85
-			if (defined('OPENSSL_TLSEXT_SERVER_NAME') && OPENSSL_TLSEXT_SERVER_NAME) {
85
+			if(defined('OPENSSL_TLSEXT_SERVER_NAME') && OPENSSL_TLSEXT_SERVER_NAME) {
86 86
 				$context_options['SNI_enabled'] = true;
87
-				if (isset($options['verifyname']) && $options['verifyname'] === false) {
87
+				if(isset($options['verifyname']) && $options['verifyname'] === false) {
88 88
 					$context_options['SNI_enabled'] = false;
89 89
 				}
90 90
 			}
91 91
 
92
-			if (isset($options['verify'])) {
93
-				if ($options['verify'] === false) {
92
+			if(isset($options['verify'])) {
93
+				if($options['verify'] === false) {
94 94
 					$context_options['verify_peer'] = false;
95 95
 				}
96
-				elseif (is_string($options['verify'])) {
96
+				elseif(is_string($options['verify'])) {
97 97
 					$context_options['cafile'] = $options['verify'];
98 98
 				}
99 99
 			}
100 100
 
101
-			if (isset($options['verifyname']) && $options['verifyname'] === false) {
101
+			if(isset($options['verifyname']) && $options['verifyname'] === false) {
102 102
 				$context_options['verify_peer_name'] = false;
103 103
 				$verifyname = false;
104 104
 			}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$this->max_bytes = $options['max_bytes'];
113 113
 
114
-		if (!isset($url_parts['port'])) {
114
+		if(!isset($url_parts['port'])) {
115 115
 			$url_parts['port'] = 80;
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
 
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 
125 125
 		restore_error_handler();
126 126
 
127
-		if ($verifyname && !$this->verify_certificate_from_context($host, $context)) {
127
+		if($verifyname && !$this->verify_certificate_from_context($host, $context)) {
128 128
 			throw new Requests_Exception('SSL certificate did not match the requested domain name', 'ssl.no_match');
129 129
 		}
130 130
 
131
-		if (!$socket) {
132
-			if ($errno === 0) {
131
+		if(!$socket) {
132
+			if($errno === 0) {
133 133
 				// Connection issue
134 134
 				throw new Requests_Exception(rtrim($this->connect_error), 'fsockopen.connect_error');
135 135
 			}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$data_format = $options['data_format'];
141 141
 
142
-		if ($data_format === 'query') {
142
+		if($data_format === 'query') {
143 143
 			$path = self::format_get($url_parts, $data);
144 144
 			$data = '';
145 145
 		}
@@ -152,56 +152,56 @@  discard block
 block discarded – undo
152 152
 		$request_body = '';
153 153
 		$out = sprintf("%s %s HTTP/%.1f\r\n", $options['type'], $path, $options['protocol_version']);
154 154
 
155
-		if ($options['type'] !== Requests::TRACE) {
156
-			if (is_array($data)) {
155
+		if($options['type'] !== Requests::TRACE) {
156
+			if(is_array($data)) {
157 157
 				$request_body = http_build_query($data, null, '&');
158 158
 			}
159 159
 			else {
160 160
 				$request_body = $data;
161 161
 			}
162 162
 
163
-			if (!empty($data)) {
164
-				if (!isset($case_insensitive_headers['Content-Length'])) {
163
+			if(!empty($data)) {
164
+				if(!isset($case_insensitive_headers['Content-Length'])) {
165 165
 					$headers['Content-Length'] = strlen($request_body);
166 166
 				}
167 167
 
168
-				if (!isset($case_insensitive_headers['Content-Type'])) {
168
+				if(!isset($case_insensitive_headers['Content-Type'])) {
169 169
 					$headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
170 170
 				}
171 171
 			}
172 172
 		}
173 173
 
174
-		if (!isset($case_insensitive_headers['Host'])) {
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";
181 181
 		}
182 182
 
183
-		if (!isset($case_insensitive_headers['User-Agent'])) {
183
+		if(!isset($case_insensitive_headers['User-Agent'])) {
184 184
 			$out .= sprintf("User-Agent: %s\r\n", $options['useragent']);
185 185
 		}
186 186
 
187 187
 		$accept_encoding = $this->accept_encoding();
188
-		if (!isset($case_insensitive_headers['Accept-Encoding']) && !empty($accept_encoding)) {
188
+		if(!isset($case_insensitive_headers['Accept-Encoding']) && !empty($accept_encoding)) {
189 189
 			$out .= sprintf("Accept-Encoding: %s\r\n", $accept_encoding);
190 190
 		}
191 191
 
192 192
 		$headers = Requests::flatten($headers);
193 193
 
194
-		if (!empty($headers)) {
194
+		if(!empty($headers)) {
195 195
 			$out .= implode($headers, "\r\n") . "\r\n";
196 196
 		}
197 197
 
198 198
 		$options['hooks']->dispatch('fsockopen.after_headers', array(&$out));
199 199
 
200
-		if (substr($out, -2) !== "\r\n") {
200
+		if(substr($out, -2) !== "\r\n") {
201 201
 			$out .= "\r\n";
202 202
 		}
203 203
 
204
-		if (!isset($case_insensitive_headers['Connection'])) {
204
+		if(!isset($case_insensitive_headers['Connection'])) {
205 205
 			$out .= "Connection: Close\r\n";
206 206
 		}
207 207
 
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 		fwrite($socket, $out);
213 213
 		$options['hooks']->dispatch('fsockopen.after_send', array($out));
214 214
 
215
-		if (!$options['blocking']) {
215
+		if(!$options['blocking']) {
216 216
 			fclose($socket);
217 217
 			$fake_headers = '';
218 218
 			$options['hooks']->dispatch('fsockopen.after_request', array(&$fake_headers));
219 219
 			return '';
220 220
 		}
221 221
 
222
-		$timeout_sec = (int) floor($options['timeout']);
223
-		if ($timeout_sec == $options['timeout']) {
222
+		$timeout_sec = (int)floor($options['timeout']);
223
+		if($timeout_sec == $options['timeout']) {
224 224
 			$timeout_msec = 0;
225 225
 		}
226 226
 		else {
@@ -233,35 +233,35 @@  discard block
 block discarded – undo
233 233
 		$size = 0;
234 234
 		$doingbody = false;
235 235
 		$download = false;
236
-		if ($options['filename']) {
236
+		if($options['filename']) {
237 237
 			$download = fopen($options['filename'], 'wb');
238 238
 		}
239 239
 
240
-		while (!feof($socket)) {
240
+		while(!feof($socket)) {
241 241
 			$this->info = stream_get_meta_data($socket);
242
-			if ($this->info['timed_out']) {
242
+			if($this->info['timed_out']) {
243 243
 				throw new Requests_Exception('fsocket timed out', 'timeout');
244 244
 			}
245 245
 
246 246
 			$block = fread($socket, Requests::BUFFER_SIZE);
247
-			if (!$doingbody) {
247
+			if(!$doingbody) {
248 248
 				$response .= $block;
249
-				if (strpos($response, "\r\n\r\n")) {
249
+				if(strpos($response, "\r\n\r\n")) {
250 250
 					list($headers, $block) = explode("\r\n\r\n", $response, 2);
251 251
 					$doingbody = true;
252 252
 				}
253 253
 			}
254 254
 
255 255
 			// Are we in body mode now?
256
-			if ($doingbody) {
256
+			if($doingbody) {
257 257
 				$options['hooks']->dispatch('request.progress', array($block, $size, $this->max_bytes));
258 258
 				$data_length = strlen($block);
259
-				if ($this->max_bytes) {
259
+				if($this->max_bytes) {
260 260
 					// Have we already hit a limit?
261
-					if ($size === $this->max_bytes) {
261
+					if($size === $this->max_bytes) {
262 262
 						continue;
263 263
 					}
264
-					if (($size + $data_length) > $this->max_bytes) {
264
+					if(($size + $data_length) > $this->max_bytes) {
265 265
 						// Limit the length
266 266
 						$limited_length = ($this->max_bytes - $size);
267 267
 						$block = substr($block, 0, $limited_length);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				}
270 270
 
271 271
 				$size += strlen($block);
272
-				if ($download) {
272
+				if($download) {
273 273
 					fwrite($download, $block);
274 274
 				}
275 275
 				else {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		}
280 280
 		$this->headers = $headers;
281 281
 
282
-		if ($download) {
282
+		if($download) {
283 283
 			fclose($download);
284 284
 		}
285 285
 		else {
@@ -301,18 +301,18 @@  discard block
 block discarded – undo
301 301
 	public function request_multiple($requests, $options) {
302 302
 		$responses = array();
303 303
 		$class = get_class($this);
304
-		foreach ($requests as $id => $request) {
304
+		foreach($requests as $id => $request) {
305 305
 			try {
306 306
 				$handler = new $class();
307 307
 				$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
308 308
 
309 309
 				$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
310 310
 			}
311
-			catch (Requests_Exception $e) {
311
+			catch(Requests_Exception $e) {
312 312
 				$responses[$id] = $e;
313 313
 			}
314 314
 
315
-			if (!is_string($responses[$id])) {
315
+			if(!is_string($responses[$id])) {
316 316
 				$request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id));
317 317
 			}
318 318
 		}
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	protected static function accept_encoding() {
329 329
 		$type = array();
330
-		if (function_exists('gzinflate')) {
330
+		if(function_exists('gzinflate')) {
331 331
 			$type[] = 'deflate;q=1.0';
332 332
 		}
333 333
 
334
-		if (function_exists('gzuncompress')) {
334
+		if(function_exists('gzuncompress')) {
335 335
 			$type[] = 'compress;q=0.5';
336 336
 		}
337 337
 
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 	 * @return string URL with data
349 349
 	 */
350 350
 	protected static function format_get($url_parts, $data) {
351
-		if (!empty($data)) {
352
-			if (empty($url_parts['query'])) {
351
+		if(!empty($data)) {
352
+			if(empty($url_parts['query'])) {
353 353
 				$url_parts['query'] = '';
354 354
 			}
355 355
 
356 356
 			$url_parts['query'] .= '&' . http_build_query($data, null, '&');
357 357
 			$url_parts['query'] = trim($url_parts['query'], '&');
358 358
 		}
359
-		if (isset($url_parts['path'])) {
360
-			if (isset($url_parts['query'])) {
359
+		if(isset($url_parts['path'])) {
360
+			if(isset($url_parts['query'])) {
361 361
 				$get = $url_parts['path'] . '?' . $url_parts['query'];
362 362
 			}
363 363
 			else {
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
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
 		}
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
 		// If we don't have SSL options, then we couldn't make the connection at
409 409
 		// all
410
-		if (empty($meta) || empty($meta['ssl']) || empty($meta['ssl']['peer_certificate'])) {
410
+		if(empty($meta) || empty($meta['ssl']) || empty($meta['ssl']['peer_certificate'])) {
411 411
 			throw new Requests_Exception(rtrim($this->connect_error), 'ssl.connect_error');
412 412
 		}
413 413
 
@@ -423,18 +423,18 @@  discard block
 block discarded – undo
423 423
 	 * @return boolean True if the transport is valid, false otherwise.
424 424
 	 */
425 425
 	public static function test($capabilities = array()) {
426
-		if (!function_exists('fsockopen')) {
426
+		if(!function_exists('fsockopen')) {
427 427
 			return false;
428 428
 		}
429 429
 
430 430
 		// If needed, check that streams support SSL
431
-		if (isset($capabilities['ssl']) && $capabilities['ssl']) {
432
-			if (!extension_loaded('openssl') || !function_exists('openssl_x509_parse')) {
431
+		if(isset($capabilities['ssl']) && $capabilities['ssl']) {
432
+			if(!extension_loaded('openssl') || !function_exists('openssl_x509_parse')) {
433 433
 				return false;
434 434
 			}
435 435
 
436 436
 			// Currently broken, thanks to https://github.com/facebook/hhvm/issues/2156
437
-			if (defined('HHVM_VERSION')) {
437
+			if(defined('HHVM_VERSION')) {
438 438
 				return false;
439 439
 			}
440 440
 		}
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Session.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$this->data = $data;
70 70
 		$this->options = $options;
71 71
 
72
-		if (empty($this->options['cookies'])) {
72
+		if(empty($this->options['cookies'])) {
73 73
 			$this->options['cookies'] = new Requests_Cookie_Jar();
74 74
 		}
75 75
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return mixed|null Property value, null if none found
82 82
 	 */
83 83
 	public function __get($key) {
84
-		if (isset($this->options[$key])) {
84
+		if(isset($this->options[$key])) {
85 85
 			return $this->options[$key];
86 86
 		}
87 87
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param string $key Property key
114 114
 	 */
115 115
 	public function __unset($key) {
116
-		if (isset($this->options[$key])) {
116
+		if(isset($this->options[$key])) {
117 117
 			unset($this->options[$key]);
118 118
 		}
119 119
 	}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @return array Responses (either Requests_Response or a Requests_Exception object)
216 216
 	 */
217 217
 	public function request_multiple($requests, $options = array()) {
218
-		foreach ($requests as $key => $request) {
218
+		foreach($requests as $key => $request) {
219 219
 			$requests[$key] = $this->merge_request($request, false);
220 220
 		}
221 221
 
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	 * @return array Request data
236 236
 	 */
237 237
 	protected function merge_request($request, $merge_options = true) {
238
-		if ($this->url !== null) {
238
+		if($this->url !== null) {
239 239
 			$request['url'] = Requests_IRI::absolutize($this->url, $request['url']);
240 240
 			$request['url'] = $request['url']->uri;
241 241
 		}
242 242
 
243
-		if (empty($request['headers'])) {
243
+		if(empty($request['headers'])) {
244 244
 			$request['headers'] = array();
245 245
 		}
246 246
 		$request['headers'] = array_merge($this->headers, $request['headers']);
247 247
 
248
-		if (empty($request['data'])) {
249
-			if (is_array($this->data)) {
248
+		if(empty($request['data'])) {
249
+			if(is_array($this->data)) {
250 250
 				$request['data'] = $this->data;
251 251
 			}
252 252
 		}
253
-		elseif (is_array($request['data']) && is_array($this->data)) {
253
+		elseif(is_array($request['data']) && is_array($this->data)) {
254 254
 			$request['data'] = array_merge($this->data, $request['data']);
255 255
 		}
256 256
 
257
-		if ($merge_options !== false) {
257
+		if($merge_options !== false) {
258 258
 			$request['options'] = array_merge($this->options, $request['options']);
259 259
 
260 260
 			// Disallow forcing the type, as that's a per request setting
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Utility/CaseInsensitiveDictionary.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param array $data Dictionary/map to convert to case-insensitive
27 27
 	 */
28 28
 	public function __construct(array $data = array()) {
29
-		foreach ($data as $key => $value) {
29
+		foreach($data as $key => $value) {
30 30
 			$this->offsetSet($key, $value);
31 31
 		}
32 32
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function offsetGet($key) {
52 52
 		$key = strtolower($key);
53
-		if (!isset($this->data[$key])) {
53
+		if(!isset($this->data[$key])) {
54 54
 			return null;
55 55
 		}
56 56
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param string $value Item value
67 67
 	 */
68 68
 	public function offsetSet($key, $value) {
69
-		if ($key === null) {
69
+		if($key === null) {
70 70
 			throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
71 71
 		}
72 72
 
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Exception/Transport/cURL.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 	protected $reason = 'Unknown';
31 31
 
32 32
 	public function __construct($message, $type, $data = null, $code = 0) {
33
-		if ($type !== null) {
33
+		if($type !== null) {
34 34
 			$this->type = $type;
35 35
 		}
36 36
 
37
-		if ($code !== null) {
37
+		if($code !== null) {
38 38
 			$this->code = $code;
39 39
 		}
40 40
 
41
-		if ($message !== null) {
41
+		if($message !== null) {
42 42
 			$this->reason = $message;
43 43
 		}
44 44
 
Please login to merge, or discard this patch.