Completed
Push — 1.11.x ( 79bd65...73103f )
by José
30:45
created
plugin/buycourses/src/Requests/Transport/cURL.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -149,8 +149,7 @@  discard block
 block discarded – undo
149 149
 			if ($options['verify'] === false) {
150 150
 				curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, 0);
151 151
 				curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, 0);
152
-			}
153
-			elseif (is_string($options['verify'])) {
152
+			} elseif (is_string($options['verify'])) {
154 153
 				curl_setopt($this->handle, CURLOPT_CAINFO, $options['verify']);
155 154
 			}
156 155
 		}
@@ -246,8 +245,7 @@  discard block
 block discarded – undo
246 245
 								);
247 246
 					$responses[$key] = $exception;
248 247
 					$options['hooks']->dispatch('transport.internal.parse_error', array(&$responses[$key], $requests[$key]));
249
-				}
250
-				else {
248
+				} else {
251 249
 					$responses[$key] = $subrequests[$key]->process_response($subrequests[$key]->response_data, $options);
252 250
 
253 251
 					$options['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$key], $requests[$key]));
@@ -322,8 +320,7 @@  discard block
 block discarded – undo
322 320
 			if ($data_format === 'query') {
323 321
 				$url = self::format_get($url, $data);
324 322
 				$data = '';
325
-			}
326
-			elseif (!is_string($data)) {
323
+			} elseif (!is_string($data)) {
327 324
 				$data = http_build_query($data, null, '&');
328 325
 			}
329 326
 		}
@@ -361,15 +358,13 @@  discard block
 block discarded – undo
361 358
 
362 359
 		if (is_int($timeout) || $this->version < self::CURL_7_16_2) {
363 360
 			curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($timeout));
364
-		}
365
-		else {
361
+		} else {
366 362
 			curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($timeout * 1000));
367 363
 		}
368 364
 
369 365
 		if (is_int($options['connect_timeout']) || $this->version < self::CURL_7_16_2) {
370 366
 			curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT, ceil($options['connect_timeout']));
371
-		}
372
-		else {
367
+		} else {
373 368
 			curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT_MS, round($options['connect_timeout'] * 1000));
374 369
 		}
375 370
 		curl_setopt($this->handle, CURLOPT_URL, $url);
@@ -380,8 +375,7 @@  discard block
 block discarded – undo
380 375
 		}
381 376
 		if ($options['protocol_version'] === 1.1) {
382 377
 			curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
383
-		}
384
-		else {
378
+		} else {
385 379
 			curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
386 380
 		}
387 381
 
@@ -408,8 +402,7 @@  discard block
 block discarded – undo
408 402
 		if ($options['filename'] !== false) {
409 403
 			fclose($this->stream_handle);
410 404
 			$this->headers = trim($this->headers);
411
-		}
412
-		else {
405
+		} else {
413 406
 			$this->headers .= $response;
414 407
 		}
415 408
 
@@ -479,8 +472,7 @@  discard block
 block discarded – undo
479 472
 
480 473
 		if ($this->stream_handle) {
481 474
 			fwrite($this->stream_handle, $data);
482
-		}
483
-		else {
475
+		} else {
484 476
 			$this->response_data .= $data;
485 477
 		}
486 478
 
@@ -500,8 +492,7 @@  discard block
 block discarded – undo
500 492
 			$url_parts = parse_url($url);
501 493
 			if (empty($url_parts['query'])) {
502 494
 				$query = $url_parts['query'] = '';
503
-			}
504
-			else {
495
+			} else {
505 496
 				$query = $url_parts['query'];
506 497
 			}
507 498
 
@@ -510,8 +501,7 @@  discard block
 block discarded – undo
510 501
 
511 502
 			if (empty($url_parts['query'])) {
512 503
 				$url .= '?' . $query;
513
-			}
514
-			else {
504
+			} else {
515 505
 				$url = str_replace($url_parts['query'], $query, $url);
516 506
 			}
517 507
 		}
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/Transport/fsockopen.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@  discard block
 block discarded – undo
92 92
 			if (isset($options['verify'])) {
93 93
 				if ($options['verify'] === false) {
94 94
 					$context_options['verify_peer'] = false;
95
-				}
96
-				elseif (is_string($options['verify'])) {
95
+				} elseif (is_string($options['verify'])) {
97 96
 					$context_options['cafile'] = $options['verify'];
98 97
 				}
99 98
 			}
@@ -104,8 +103,7 @@  discard block
 block discarded – undo
104 103
 			}
105 104
 
106 105
 			stream_context_set_option($context, array('ssl' => $context_options));
107
-		}
108
-		else {
106
+		} else {
109 107
 			$remote_socket = 'tcp://' . $host;
110 108
 		}
111 109
 
@@ -142,8 +140,7 @@  discard block
 block discarded – undo
142 140
 		if ($data_format === 'query') {
143 141
 			$path = self::format_get($url_parts, $data);
144 142
 			$data = '';
145
-		}
146
-		else {
143
+		} else {
147 144
 			$path = self::format_get($url_parts, array());
148 145
 		}
149 146
 
@@ -155,8 +152,7 @@  discard block
 block discarded – undo
155 152
 		if ($options['type'] !== Requests::TRACE) {
156 153
 			if (is_array($data)) {
157 154
 				$request_body = http_build_query($data, null, '&');
158
-			}
159
-			else {
155
+			} else {
160 156
 				$request_body = $data;
161 157
 			}
162 158
 
@@ -222,8 +218,7 @@  discard block
 block discarded – undo
222 218
 		$timeout_sec = (int) floor($options['timeout']);
223 219
 		if ($timeout_sec == $options['timeout']) {
224 220
 			$timeout_msec = 0;
225
-		}
226
-		else {
221
+		} else {
227 222
 			$timeout_msec = self::SECOND_IN_MICROSECONDS * $options['timeout'] % self::SECOND_IN_MICROSECONDS;
228 223
 		}
229 224
 		stream_set_timeout($socket, $timeout_sec, $timeout_msec);
@@ -271,8 +266,7 @@  discard block
 block discarded – undo
271 266
 				$size += strlen($block);
272 267
 				if ($download) {
273 268
 					fwrite($download, $block);
274
-				}
275
-				else {
269
+				} else {
276 270
 					$body .= $block;
277 271
 				}
278 272
 			}
@@ -281,8 +275,7 @@  discard block
 block discarded – undo
281 275
 
282 276
 		if ($download) {
283 277
 			fclose($download);
284
-		}
285
-		else {
278
+		} else {
286 279
 			$this->headers .= "\r\n\r\n" . $body;
287 280
 		}
288 281
 		fclose($socket);
@@ -307,8 +300,7 @@  discard block
 block discarded – undo
307 300
 				$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
308 301
 
309 302
 				$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
310
-			}
311
-			catch (Requests_Exception $e) {
303
+			} catch (Requests_Exception $e) {
312 304
 				$responses[$id] = $e;
313 305
 			}
314 306
 
@@ -359,12 +351,10 @@  discard block
 block discarded – undo
359 351
 		if (isset($url_parts['path'])) {
360 352
 			if (isset($url_parts['query'])) {
361 353
 				$get = $url_parts['path'] . '?' . $url_parts['query'];
362
-			}
363
-			else {
354
+			} else {
364 355
 				$get = $url_parts['path'];
365 356
 			}
366
-		}
367
-		else {
357
+		} else {
368 358
 			$get = '/';
369 359
 		}
370 360
 		return $get;
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/IRI.php 1 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
 					}
@@ -760,12 +742,10 @@  discard block
 block discarded – undo
760 742
 	protected function set_scheme($scheme) {
761 743
 		if ($scheme === null) {
762 744
 			$this->scheme = null;
763
-		}
764
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
745
+		} elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
765 746
 			$this->scheme = null;
766 747
 			return false;
767
-		}
768
-		else {
748
+		} else {
769 749
 			$this->scheme = strtolower($scheme);
770 750
 		}
771 751
 		return true;
@@ -803,8 +783,7 @@  discard block
 block discarded – undo
803 783
 		if (($iuserinfo_end = strrpos($remaining, '@')) !== false) {
804 784
 			$iuserinfo = substr($remaining, 0, $iuserinfo_end);
805 785
 			$remaining = substr($remaining, $iuserinfo_end + 1);
806
-		}
807
-		else {
786
+		} else {
808 787
 			$iuserinfo = null;
809 788
 		}
810 789
 		if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) {
@@ -813,8 +792,7 @@  discard block
 block discarded – undo
813 792
 				$port = null;
814 793
 			}
815 794
 			$remaining = substr($remaining, 0, $port_start);
816
-		}
817
-		else {
795
+		} else {
818 796
 			$port = null;
819 797
 		}
820 798
 
@@ -839,8 +817,7 @@  discard block
 block discarded – undo
839 817
 	protected function set_userinfo($iuserinfo) {
840 818
 		if ($iuserinfo === null) {
841 819
 			$this->iuserinfo = null;
842
-		}
843
-		else {
820
+		} else {
844 821
 			$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
845 822
 			$this->scheme_normalization();
846 823
 		}
@@ -863,13 +840,11 @@  discard block
 block discarded – undo
863 840
 		if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
864 841
 			if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
865 842
 				$this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']';
866
-			}
867
-			else {
843
+			} else {
868 844
 				$this->ihost = null;
869 845
 				return false;
870 846
 			}
871
-		}
872
-		else {
847
+		} else {
873 848
 			$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
874 849
 
875 850
 			// Lowercase, but ignore pct-encoded sections (as they should
@@ -880,8 +855,7 @@  discard block
 block discarded – undo
880 855
 			while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) {
881 856
 				if ($ihost[$position] === '%') {
882 857
 					$position += 3;
883
-				}
884
-				else {
858
+				} else {
885 859
 					$ihost[$position] = strtolower($ihost[$position]);
886 860
 					$position++;
887 861
 				}
@@ -934,8 +908,7 @@  discard block
 block discarded – undo
934 908
 
935 909
 		if (isset($cache[$ipath])) {
936 910
 			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
937
-		}
938
-		else {
911
+		} else {
939 912
 			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
940 913
 			$removed = $this->remove_dot_segments($valid);
941 914
 
@@ -955,8 +928,7 @@  discard block
 block discarded – undo
955 928
 	protected function set_query($iquery) {
956 929
 		if ($iquery === null) {
957 930
 			$this->iquery = null;
958
-		}
959
-		else {
931
+		} else {
960 932
 			$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
961 933
 			$this->scheme_normalization();
962 934
 		}
@@ -972,8 +944,7 @@  discard block
 block discarded – undo
972 944
 	protected function set_fragment($ifragment) {
973 945
 		if ($ifragment === null) {
974 946
 			$this->ifragment = null;
975
-		}
976
-		else {
947
+		} else {
977 948
 			$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
978 949
 			$this->scheme_normalization();
979 950
 		}
@@ -1076,8 +1047,7 @@  discard block
 block discarded – undo
1076 1047
 		$iauthority = $this->get_iauthority();
1077 1048
 		if (is_string($iauthority)) {
1078 1049
 			return $this->to_uri($iauthority);
1079
-		}
1080
-		else {
1050
+		} else {
1081 1051
 			return $iauthority;
1082 1052
 		}
1083 1053
 	}
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/IPv6.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -106,8 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 		if ($ip_parts[1] !== '') {
108 108
 			return implode(':', $ip_parts);
109
-		}
110
-		else {
109
+		} else {
111 110
 			return $ip_parts[0];
112 111
 		}
113 112
 	}
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
 			$ipv6_part = substr($ip, 0, $pos);
131 130
 			$ipv4_part = substr($ip, $pos + 1);
132 131
 			return array($ipv6_part, $ipv4_part);
133
-		}
134
-		else {
132
+		} else {
135 133
 			return array($ip, '');
136 134
 		}
137 135
 	}
@@ -182,8 +180,7 @@  discard block
 block discarded – undo
182 180
 				}
183 181
 			}
184 182
 			return true;
185
-		}
186
-		else {
183
+		} else {
187 184
 			return false;
188 185
 		}
189 186
 	}
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -370,8 +370,7 @@  discard block
 block discarded – undo
370 370
 			if (is_string($options['transport'])) {
371 371
 				$transport = new $transport();
372 372
 			}
373
-		}
374
-		else {
373
+		} else {
375 374
 			$need_ssl = (0 === stripos($url, 'https://'));
376 375
 			$capabilities = array('ssl' => $need_ssl);
377 376
 			$transport = self::get_transport($capabilities);
@@ -447,8 +446,7 @@  discard block
 block discarded – undo
447 446
 			if (!isset($request['options'])) {
448 447
 				$request['options'] = $options;
449 448
 				$request['options']['type'] = $request['type'];
450
-			}
451
-			else {
449
+			} else {
452 450
 				if (empty($request['options']['type'])) {
453 451
 					$request['options']['type'] = $request['type'];
454 452
 				}
@@ -473,8 +471,7 @@  discard block
 block discarded – undo
473 471
 			if (is_string($options['transport'])) {
474 472
 				$transport = new $transport();
475 473
 			}
476
-		}
477
-		else {
474
+		} else {
478 475
 			$transport = self::get_transport();
479 476
 		}
480 477
 		$responses = $transport->request_multiple($requests, $options);
@@ -584,8 +581,7 @@  discard block
 block discarded – undo
584 581
 
585 582
 		if (is_array($options['cookies'])) {
586 583
 			$options['cookies'] = new Requests_Cookie_Jar($options['cookies']);
587
-		}
588
-		elseif (empty($options['cookies'])) {
584
+		} elseif (empty($options['cookies'])) {
589 585
 			$options['cookies'] = new Requests_Cookie_Jar();
590 586
 		}
591 587
 		if ($options['cookies'] !== false) {
@@ -604,8 +600,7 @@  discard block
 block discarded – undo
604 600
 		if (!isset($options['data_format'])) {
605 601
 			if (in_array($type, array(self::HEAD, self::GET, self::DELETE))) {
606 602
 				$options['data_format'] = 'query';
607
-			}
608
-			else {
603
+			} else {
609 604
 				$options['data_format'] = 'body';
610 605
 			}
611 606
 		}
@@ -642,8 +637,7 @@  discard block
 block discarded – undo
642 637
 
643 638
 			$headers = substr($return->raw, 0, $pos);
644 639
 			$return->body = substr($return->raw, $pos + strlen("\n\r\n\r"));
645
-		}
646
-		else {
640
+		} else {
647 641
 			$return->body = '';
648 642
 		}
649 643
 		// Pretend CRLF = LF for compatibility (RFC 2616, section 19.3)
@@ -706,8 +700,7 @@  discard block
 block discarded – undo
706 700
 				$redirected = self::request($location, $req_headers, $req_data, $options['type'], $options);
707 701
 				$redirected->history[] = $return;
708 702
 				return $redirected;
709
-			}
710
-			elseif ($options['redirected'] >= $options['redirects']) {
703
+			} elseif ($options['redirected'] >= $options['redirects']) {
711 704
 				throw new Requests_Exception('Too many redirects', 'toomanyredirects', $return);
712 705
 			}
713 706
 		}
@@ -735,8 +728,7 @@  discard block
 block discarded – undo
735 728
 			$data = $request['data'];
736 729
 			$options = $request['options'];
737 730
 			$response = self::parse_response($response, $url, $headers, $data, $options);
738
-		}
739
-		catch (Requests_Exception $e) {
731
+		} catch (Requests_Exception $e) {
740 732
 			$response = $e;
741 733
 		}
742 734
 	}
@@ -828,14 +820,11 @@  discard block
 block discarded – undo
828 820
 
829 821
 		if (function_exists('gzdecode') && ($decoded = @gzdecode($data)) !== false) {
830 822
 			return $decoded;
831
-		}
832
-		elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) {
823
+		} elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) {
833 824
 			return $decoded;
834
-		}
835
-		elseif (($decoded = self::compatible_gzinflate($data)) !== false) {
825
+		} elseif (($decoded = self::compatible_gzinflate($data)) !== false) {
836 826
 			return $decoded;
837
-		}
838
-		elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) {
827
+		} elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) {
839 828
 			return $decoded;
840 829
 		}
841 830
 
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/Culqi.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,11 +33,9 @@
 block discarded – undo
33 33
     {
34 34
         if ($entorno == 'INTEG') {
35 35
             self::$api_base = "https://integ-pago.culqi.com/api/v1";
36
-        }
37
-        elseif ($entorno == 'PRODUC') {
36
+        } elseif ($entorno == 'PRODUC') {
38 37
             self::$api_base = "https://pago.culqi.com/api/v1";
39
-        }
40
-        else {
38
+        } else {
41 39
              self::$api_base = "https://integ-pago.culqi.com/api/v1";
42 40
         }
43 41
 
Please login to merge, or discard this patch.
plugin/vchamilo/cli/bulkcreatenodes.php 1 patch
Braces   +17 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,8 +74,14 @@  discard block
 block discarded – undo
74 74
 
75 75
     $content = file($options['config']);
76 76
     foreach($content as $l) {
77
-        if (preg_match('/^\s+$/', $l)) continue; // Empty lines.
78
-        if (preg_match('/^[#\/!;]/', $l)) continue; // Comments (any form).
77
+        if (preg_match('/^\s+$/', $l)) {
78
+            continue;
79
+        }
80
+        // Empty lines.
81
+        if (preg_match('/^[#\/!;]/', $l)) {
82
+            continue;
83
+        }
84
+        // Comments (any form).
79 85
         if (preg_match('/^(.*?)=(.*)$/', $l, $matches)) {
80 86
             if (in_array($matches[1], $expectedoptions)){
81 87
                 $options[trim($matches[1])] = trim($matches[2]);
@@ -90,16 +96,22 @@  discard block
 block discarded – undo
90 96
 require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php');
91 97
 
92 98
 global $DB;
93
-if ($options['verbose']) echo "building database manager\n";
99
+if ($options['verbose']) {
100
+    echo "building database manager\n";
101
+}
94 102
 $DB = new DatabaseManager();
95
-if ($options['verbose']) echo "building plugin vchamilo\n";
103
+if ($options['verbose']) {
104
+    echo "building plugin vchamilo\n";
105
+}
96 106
 $plugin = VChamiloPlugin::create();
97 107
 
98 108
 if (empty($options['nodes'])) {
99 109
     cli_error('Missing node definition. Halt.');
100 110
 }
101 111
 
102
-if ($options['verbose']) echo "parsing nodelist\n";
112
+if ($options['verbose']) {
113
+    echo "parsing nodelist\n";
114
+}
103 115
 $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugin);
104 116
 
105 117
 if ($options['lint']) {
Please login to merge, or discard this patch.
plugin/vchamilo/cli/bulkdestroynodes.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -92,25 +92,39 @@
 block discarded – undo
92 92
 }
93 93
 
94 94
 require_once($_configuration['root_sys'].'local/classes/database.class.php');       // cli only functions
95
-if ($options['verbose']) echo "loaded dbclass\n";
95
+if ($options['verbose']) {
96
+    echo "loaded dbclass\n";
97
+}
96 98
 require_once($_configuration['root_sys'].'local/classes/textlib.class.php');       // cli only functions
97
-if ($options['verbose']) echo "loaded textlib\n";
99
+if ($options['verbose']) {
100
+    echo "loaded textlib\n";
101
+}
98 102
 require_once($_configuration['root_sys'].'local/classes/mootochamlib.php');       // moodle like API
99
-if ($options['verbose']) echo "loaded moodle wrapping\n";
103
+if ($options['verbose']) {
104
+    echo "loaded moodle wrapping\n";
105
+}
100 106
 require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php');
101
-if ($options['verbose']) echo "loaded vchamilo plugin\n";
107
+if ($options['verbose']) {
108
+    echo "loaded vchamilo plugin\n";
109
+}
102 110
 
103 111
 global $DB;
104
-if ($options['verbose']) echo "building database manager\n";
112
+if ($options['verbose']) {
113
+    echo "building database manager\n";
114
+}
105 115
 $DB = new DatabaseManager();
106
-if ($options['verbose']) echo "building plugin vchamilo\n";
116
+if ($options['verbose']) {
117
+    echo "building plugin vchamilo\n";
118
+}
107 119
 $plugin = VChamiloPlugin::create();
108 120
 
109 121
 if (empty($options['nodes'])) {
110 122
     cli_error(get_string('climissingnodes', 'block_vmoodle'));
111 123
 }
112 124
 
113
-if ($options['verbose']) echo "parsing nodelist\n";
125
+if ($options['verbose']) {
126
+    echo "parsing nodelist\n";
127
+}
114 128
 $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugin);
115 129
 
116 130
 if ($options['lint']) {
Please login to merge, or discard this patch.
plugin/bbb/lib/bbb_api.php 1 patch
Braces   +28 added lines, -40 removed lines patch added patch discarded remove patch
@@ -73,10 +73,11 @@  discard block
 block discarded – undo
73 73
 			$data = curl_exec( $ch );
74 74
 			curl_close( $ch );
75 75
 
76
-			if($data)
77
-				return (new SimpleXMLElement($data));
78
-			else
79
-				return false;
76
+			if($data) {
77
+							return (new SimpleXMLElement($data));
78
+			} else {
79
+							return false;
80
+			}
80 81
 		}
81 82
 		return (simplexml_load_file($url));
82 83
 	}
@@ -85,11 +86,9 @@  discard block
 block discarded – undo
85 86
 		/* Process required params and throw errors if we don't get values */
86 87
 		if ((isset($param)) && ($param != '')) {
87 88
 			return $param;
88
-		}
89
-		elseif (!isset($param)) {
89
+		} elseif (!isset($param)) {
90 90
 			throw new Exception('Missing parameter.');
91
-		}
92
-		else {
91
+		} else {
93 92
 			throw new Exception(''.$param.' is required.');
94 93
 		}
95 94
 	}
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
 		/* Don't know if we'll use this one, but let's build it in case. */
100 99
 		if ((isset($param)) && ($param != '')) {
101 100
 			return $param;
102
-		}
103
-		else {
101
+		} else {
104 102
 			$param = '';
105 103
 			return $param;
106 104
 		}
@@ -137,8 +135,9 @@  discard block
 block discarded – undo
137 135
 		'&duration='.urlencode($creationParams['duration']);
138 136
 		//'&meta_category='.urlencode($creationParams['meta_category']);
139 137
 		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
141
-			$params .= '&welcome='.urlencode($welcomeMessage);
138
+		if(trim($welcomeMessage)) {
139
+					$params .= '&welcome='.urlencode($welcomeMessage);
140
+		}
142 141
 		// Return the complete URL:
143 142
 		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144 143
 	}
@@ -165,8 +164,8 @@  discard block
 block discarded – undo
165 164
 		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 165
 
167 166
         if ($xml) {
168
-			if($xml->meetingID)
169
-				return array(
167
+			if($xml->meetingID) {
168
+							return array(
170 169
 					'returncode' => $xml->returncode->__toString(),
171 170
 					'message' => $xml->message->__toString(),
172 171
 					'messageKey' => $xml->messageKey->__toString(),
@@ -176,14 +175,14 @@  discard block
 block discarded – undo
176 175
 					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177 176
 					'createTime' => $xml->createTime->__toString()
178 177
 					);
179
-			else
180
-				return array(
178
+			} else {
179
+							return array(
181 180
 					'returncode' => $xml->returncode->__toString(),
182 181
 					'message' => $xml->message->__toString(),
183 182
 					'messageKey' => $xml->messageKey->__toString()
184 183
 					);
185
-		}
186
-		else {
184
+			}
185
+		} else {
187 186
 			return null;
188 187
 		}
189 188
 	}
@@ -253,8 +252,7 @@  discard block
 block discarded – undo
253 252
 				'message' => $xml->message->__toString(),
254 253
 				'messageKey' => $xml->messageKey->__toString()
255 254
 				);
256
-		}
257
-		else {
255
+		} else {
258 256
 			return null;
259 257
 		}
260 258
 
@@ -288,8 +286,7 @@  discard block
 block discarded – undo
288 286
 				'returncode' => $xml->returncode->__toString(),
289 287
 				'running' => $xml->running->__toString() 	// -- Returns true/false.
290 288
 			);
291
-		}
292
-		else {
289
+		} else {
293 290
 			return null;
294 291
 		}
295 292
 
@@ -317,8 +314,7 @@  discard block
 block discarded – undo
317 314
 					'returncode' => $xml->returncode->__toString()
318 315
 				);
319 316
 				return $result;
320
-			}
321
-			elseif ($xml->messageKey == 'noMeetings') {
317
+			} elseif ($xml->messageKey == 'noMeetings') {
322 318
 				/* No meetings on server, so return just this info: */
323 319
 				$result = array(
324 320
 					'returncode' => $xml->returncode->__toString(),
@@ -326,8 +322,7 @@  discard block
 block discarded – undo
326 322
 					'message' => $xml->message->__toString()
327 323
 				);
328 324
 				return $result;
329
-			}
330
-			else {
325
+			} else {
331 326
 				// In this case, we have success and meetings. First return general response:
332 327
 				$result = array(
333 328
 					'returncode' => $xml->returncode->__toString(),
@@ -348,8 +343,7 @@  discard block
 block discarded – undo
348 343
 				}
349 344
 				return $result;
350 345
 			}
351
-		}
352
-		else {
346
+		} else {
353 347
 			return null;
354 348
 		}
355 349
 
@@ -388,8 +382,7 @@  discard block
 block discarded – undo
388 382
 					'message' => $xml->message->__toString()
389 383
 				);
390 384
 				return $result;
391
-			}
392
-			else {
385
+			} else {
393 386
 				// In this case, we have success and meeting info:
394 387
 				$result = array(
395 388
 					'returncode' => $xml->returncode->__toString(),
@@ -418,8 +411,7 @@  discard block
 block discarded – undo
418 411
 				}
419 412
 				return $result;
420 413
 			}
421
-		}
422
-		else {
414
+		} else {
423 415
 			return null;
424 416
 		}
425 417
 
@@ -463,8 +455,7 @@  discard block
 block discarded – undo
463 455
 					'message' => $xml->message->__toString()
464 456
 				);
465 457
 				return $result;
466
-			}
467
-			else {
458
+			} else {
468 459
 				// In this case, we have success and recording info:
469 460
 				$result = array(
470 461
 					'returncode' => $xml->returncode->__toString(),
@@ -495,8 +486,7 @@  discard block
 block discarded – undo
495 486
 					}
496 487
 				return $result;
497 488
 			}
498
-		}
499
-		else {
489
+		} else {
500 490
 			return null;
501 491
 		}
502 492
 	}
@@ -529,8 +519,7 @@  discard block
 block discarded – undo
529 519
 				'returncode' => $xml->returncode->__toString(),
530 520
 				'published' => $xml->published->__toString() 	// -- Returns true/false.
531 521
 			);
532
-		}
533
-		else {
522
+		} else {
534 523
 			return null;
535 524
 		}
536 525
 
@@ -562,8 +551,7 @@  discard block
 block discarded – undo
562 551
 				'returncode' => $xml->returncode->__toString(),
563 552
 				'deleted' => $xml->deleted->__toString() 	// -- Returns true/false.
564 553
 			);
565
-		}
566
-		else {
554
+		} else {
567 555
 			return null;
568 556
 		}
569 557
 
Please login to merge, or discard this patch.