Completed
Pull Request — 1.11.x (#1688)
by José
28:44
created
plugin/buycourses/src/Requests/IRI.php 1 patch
Spacing   +21 added lines, -21 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
 
@@ -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;
@@ -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
 	/**
@@ -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
 
@@ -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;
@@ -1019,17 +1019,17 @@  discard block
 block discarded – undo
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.
plugin/buycourses/src/Requests/IPv6.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 		}
63 63
 		// xxx::xxx
64 64
 		else {
65
-			$fill = ':' . str_repeat('0:', 6 - $c2 - $c1);
65
+			$fill = ':'.str_repeat('0:', 6 - $c2 - $c1);
66 66
 			$ip = str_replace('::', $fill, $ip);
67 67
 		}
68 68
 		return $ip;
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 
144 144
 		$file = str_replace('_', '/', $class);
145
-		if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) {
146
-			require_once(dirname(__FILE__) . '/' . $file . '.php');
145
+		if (file_exists(dirname(__FILE__).'/'.$file.'.php')) {
146
+			require_once(dirname(__FILE__).'/'.$file.'.php');
147 147
 		}
148 148
 	}
149 149
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$defaults = array(
504 504
 			'timeout' => 10,
505 505
 			'connect_timeout' => 10,
506
-			'useragent' => 'php-requests/' . self::VERSION,
506
+			'useragent' => 'php-requests/'.self::VERSION,
507 507
 			'protocol_version' => 1.1,
508 508
 			'redirected' => 0,
509 509
 			'redirects' => 10,
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	 * @return string Default certificate path.
534 534
 	 */
535 535
 	public static function get_certificate_path() {
536
-		if ( ! empty( Requests::$certificate_path ) ) {
536
+		if (!empty(Requests::$certificate_path)) {
537 537
 			return Requests::$certificate_path;
538 538
 		}
539 539
 
540
-		return dirname(__FILE__) . '/Requests/Transport/cacert.pem';
540
+		return dirname(__FILE__).'/Requests/Transport/cacert.pem';
541 541
 	}
542 542
 
543 543
 	/**
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * @param string $path Certificate path, pointing to a PEM file.
547 547
 	 */
548
-	public static function set_certificate_path( $path ) {
548
+	public static function set_certificate_path($path) {
549 549
 		Requests::$certificate_path = $path;
550 550
 	}
551 551
 
Please login to merge, or discard this patch.
plugin/buycourses/src/culqi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
  */
15 15
 
16 16
 // Errors
17
-include_once(dirname(__FILE__). '/Culqi/Error/Errors.php');
18
-include_once(dirname(__FILE__). '/Culqi/AuthBearer.php');
17
+include_once(dirname(__FILE__).'/Culqi/Error/Errors.php');
18
+include_once(dirname(__FILE__).'/Culqi/AuthBearer.php');
19 19
 include_once dirname(__FILE__).'/Culqi/Client.php';
20 20
 include_once dirname(__FILE__).'/Culqi/Resource.php';
21 21
 
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/Planes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
     public function get($id)
22 22
     {
23 23
 
24
-        return $this->request("GET", Planes::URL_PLANES . $id . "/", $api_key = $this->culqi->api_key);
24
+        return $this->request("GET", Planes::URL_PLANES.$id."/", $api_key = $this->culqi->api_key);
25 25
     }
26 26
 
27 27
     public function delete($id)
28 28
     {
29 29
 
30
-       return $this->request("DELETE", Planes::URL_PLANES . $id . "/", $api_key = $this->culqi->api_key);
30
+       return $this->request("DELETE", Planes::URL_PLANES.$id."/", $api_key = $this->culqi->api_key);
31 31
 
32 32
    }
33 33
 
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/AuthBearer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 		$this->password = $password;
11 11
 	}
12 12
 
13
-	public function register(\Requests_Hooks &$hooks) {
13
+	public function register(\Requests_Hooks & $hooks) {
14 14
 		$hooks->register('requests.before_request', array(&$this, 'before_request'));
15 15
 	}
16 16
 
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/Devoluciones.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function get($id)
19 19
     {
20
-        return $this->request("GET", Devoluciones::URL_REFUND . $id . "/", $api_key = $this->culqi->api_key);
20
+        return $this->request("GET", Devoluciones::URL_REFUND.$id."/", $api_key = $this->culqi->api_key);
21 21
     }
22 22
 
23 23
 
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/Client.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@
 block discarded – undo
17 17
     const BASE_URL = "https://integ-pago.culqi.com/api/v1";
18 18
 
19 19
 
20
-    public function request($method, $url, $api_key, $data = NULL, $headers= array("Content-Type" => "application/json", "Accept" => "application/json") ) {
20
+    public function request($method, $url, $api_key, $data = NULL, $headers = array("Content-Type" => "application/json", "Accept" => "application/json")) {
21 21
         try {
22 22
             $options = array(
23 23
                 'auth' => new AuthBearer($api_key),
24 24
                 'timeout' => 120
25 25
             );
26
-            if($method == "GET") {
27
-                $url_params = is_array($data) ? '?' . http_build_query($data) : '';
28
-                $response = \Requests::get(Culqi::$api_base . $url . $url_params, $headers, $options);
29
-            } else if($method == "POST") {
30
-                $response = \Requests::post(Culqi::$api_base . $url, $headers, json_encode($data), $options);
26
+            if ($method == "GET") {
27
+                $url_params = is_array($data) ? '?'.http_build_query($data) : '';
28
+                $response = \Requests::get(Culqi::$api_base.$url.$url_params, $headers, $options);
29
+            } else if ($method == "POST") {
30
+                $response = \Requests::post(Culqi::$api_base.$url, $headers, json_encode($data), $options);
31 31
 
32 32
 
33
-            } else if($method == "PATCH") {
34
-                $response = \Requests::patch(Culqi::$api_base . $url, $headers, json_encode($data), $options);
35
-            } else if($method == "DELETE") {
33
+            } else if ($method == "PATCH") {
34
+                $response = \Requests::patch(Culqi::$api_base.$url, $headers, json_encode($data), $options);
35
+            } else if ($method == "DELETE") {
36 36
                 $response = \Requests::delete(Culqi::$api_base, $options);
37 37
             }
38 38
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/Cargos.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function get($id)
19 19
     {
20
-        return $this->request("GET", Cargos::URL_CARGOS . $id . "/", $api_key = $this->culqi->api_key);
20
+        return $this->request("GET", Cargos::URL_CARGOS.$id."/", $api_key = $this->culqi->api_key);
21 21
     }
22 22
 
23 23
 
Please login to merge, or discard this patch.