Completed
Pull Request — 1.11.x (#1599)
by José
28:19
created
plugin/buycourses/src/buy_course_plugin.class.php 1 patch
Doc Comments   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     /**
51 51
      *
52
-     * @return StaticPlugin
52
+     * @return BuyCoursesPlugin
53 53
      */
54 54
     static function create()
55 55
     {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     /**
278 278
      * Save a transfer account information
279 279
      * @param array $params The transfer account
280
-     * @return int Rows affected. Otherwise return false
280
+     * @return false|string Rows affected. Otherwise return false
281 281
      */
282 282
     public function saveTransferAccount($params)
283 283
     {
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
     /**
691 691
      * Get session info
692 692
      * @param array $sessionId The session ID
693
-     * @return array
693
+     * @return Session
694 694
      */
695 695
     public function getSessionInfo($sessionId)
696 696
     {
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
      * Register a sale
784 784
      * @param int $itemId The product ID
785 785
      * @param int $paymentType The payment type
786
-     * @return boolean
786
+     * @return false|string
787 787
      */
788 788
     public function registerSale($itemId, $paymentType)
789 789
     {
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
     /**
967 967
      * Get payment types
968
-     * @return array
968
+     * @return string[]
969 969
      */
970 970
     public function getPaymentTypes()
971 971
     {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
     /**
1006 1006
      * Get the statuses for sales
1007
-     * @return array
1007
+     * @return string[]
1008 1008
      */
1009 1009
     public function getSaleStatuses()
1010 1010
     {
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 
1018 1018
     /**
1019 1019
      * Get the statuses for Payouts
1020
-     * @return array
1020
+     * @return string[]
1021 1021
      */
1022 1022
     public function getPayoutStatuses()
1023 1023
     {
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 
1031 1031
     /**
1032 1032
      * Get the list of product types
1033
-     * @return array
1033
+     * @return string[]
1034 1034
      */
1035 1035
     public function getProductTypes()
1036 1036
     {
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 
1043 1043
     /**
1044 1044
      * Get the list of service types
1045
-     * @return array
1045
+     * @return string[]
1046 1046
      */
1047 1047
     public function getServiceTypes()
1048 1048
     {
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
     /**
1425 1425
      * Register a item
1426 1426
      * @param array $itemData The item data
1427
-     * @return int The item ID. Otherwise return false
1427
+     * @return false|string The item ID. Otherwise return false
1428 1428
      */
1429 1429
     public function registerItem(array $itemData)
1430 1430
     {
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
     /**
1583 1583
      * Verify if the beneficiary have a paypal account
1584 1584
      * @param int $userId
1585
-     * @return true if the user have a paypal account, false if not
1585
+     * @return boolean if the user have a paypal account, false if not
1586 1586
      */
1587 1587
     public function verifyPaypalAccountByBeneficiary($userId)
1588 1588
     {
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
     /**
1705 1705
      * Register addicional service
1706 1706
      * @param array params $service
1707
-     * @return mixed response
1707
+     * @return string|false response
1708 1708
      */
1709 1709
     public function storeService($service)
1710 1710
     {
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
 
1862 1862
     /**
1863 1863
      * Get the statuses for sales
1864
-     * @return array
1864
+     * @return string[]
1865 1865
      */
1866 1866
     public function getServiceSaleStatuses()
1867 1867
     {
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
      * @param int $paymentType The payment type
2119 2119
      * @param int $infoSelect The ID for Service Type
2120 2120
      * @param int $trial trial mode
2121
-     * @return boolean
2121
+     * @return false|string
2122 2122
      */
2123 2123
     public function registerServiceSale($serviceId, $paymentType, $infoSelect, $trial = null)
2124 2124
     {
Please login to merge, or discard this patch.
plugin/buycourses/src/Culqi/Client.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
     const BASE_URL = "https://integ-pago.culqi.com/api/v1";
18 18
 
19 19
 
20
+    /**
21
+     * @param string $method
22
+     */
20 23
     public function request($method, $url, $api_key, $data = NULL, $headers= array("Content-Type" => "application/json", "Accept" => "application/json") ) {
21 24
         try {
22 25
             $options = array(
Please login to merge, or discard this 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/Resource.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -3,6 +3,9 @@
 block discarded – undo
3 3
 
4 4
 class Resource extends Client {
5 5
 
6
+    /**
7
+     * @param Culqi $culqi
8
+     */
6 9
     public function __construct($culqi)
7 10
     {
8 11
         $this->culqi = $culqi;
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -226,6 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	/**
228 228
 	 * Send a GET request
229
+	 * @param string $url
229 230
 	 */
230 231
 	public static function get($url, $headers = array(), $options = array()) {
231 232
 		return self::request($url, $headers, null, self::GET, $options);
@@ -240,6 +241,7 @@  discard block
 block discarded – undo
240 241
 
241 242
 	/**
242 243
 	 * Send a DELETE request
244
+	 * @param string $url
243 245
 	 */
244 246
 	public static function delete($url, $headers = array(), $options = array()) {
245 247
 		return self::request($url, $headers, null, self::DELETE, $options);
@@ -263,6 +265,7 @@  discard block
 block discarded – undo
263 265
 	 */
264 266
 	/**
265 267
 	 * Send a POST request
268
+	 * @param string $url
266 269
 	 */
267 270
 	public static function post($url, $headers = array(), $data = array(), $options = array()) {
268 271
 		return self::request($url, $headers, $data, self::POST, $options);
@@ -288,6 +291,7 @@  discard block
 block discarded – undo
288 291
 	 * specification recommends that should send an ETag
289 292
 	 *
290 293
 	 * @link https://tools.ietf.org/html/rfc5789
294
+	 * @param string $url
291 295
 	 */
292 296
 	public static function patch($url, $headers, $data = array(), $options = array()) {
293 297
 		return self::request($url, $headers, $data, self::PATCH, $options);
Please login to merge, or discard this 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/Requests/Cookie.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @param string $name
64 64
 	 * @param string $value
65
-	 * @param array|Requests_Utility_CaseInsensitiveDictionary $attributes Associative array of attribute data
65
+	 * @param Requests_Utility_CaseInsensitiveDictionary $attributes Associative array of attribute data
66 66
 	 */
67 67
 	public function __construct($name, $value, $attributes = array(), $flags = array(), $reference_time = null) {
68 68
 		$this->name = $name;
@@ -377,6 +377,7 @@  discard block
 block discarded – undo
377 377
 	 * specifies some of this handling, but not in a thorough manner.
378 378
 	 *
379 379
 	 * @param string Cookie header value (from a Set-Cookie header)
380
+	 * @param integer $reference_time
380 381
 	 * @return Requests_Cookie Parsed cookie object
381 382
 	 */
382 383
 	public static function parse($string, $name = '', $reference_time = null) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 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
 	}
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/IDNAEncoder.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@
 block discarded – undo
357 357
 	 * @param int $delta
358 358
 	 * @param int $numpoints
359 359
 	 * @param bool $firsttime
360
-	 * @return int New bias
360
+	 * @return double New bias
361 361
 	 */
362 362
 	protected static function adapt($delta, $numpoints, $firsttime) {
363 363
 #	function adapt(delta,numpoints,firsttime):
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 		$string = self::punycode_encode($string);
94 94
 
95 95
 		// Step 7: Prepend ACE prefix
96
-		$string = self::ACE_PREFIX . $string;
96
+		$string = self::ACE_PREFIX.$string;
97 97
 
98 98
 		// Step 8: Check size
99 99
 		if (strlen($string) < 64) {
Please login to merge, or discard this patch.
plugin/buycourses/src/Requests/IRI.php 2 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
 	 */
@@ -984,6 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * Convert an IRI to a URI (or parts thereof)
985 985
 	 *
986 986
 	 * @param string|bool IRI to convert (or false from {@see get_iri})
987
+	 * @param false|string $string
987 988
 	 * @return string|false URI if IRI is valid, false otherwise.
988 989
 	 */
989 990
 	protected function to_uri($string) {
Please login to merge, or discard this 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/Session.php 1 patch
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.
plugin/buycourses/src/Requests/Proxy/HTTP.php 1 patch
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.