@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -17,6 +17,9 @@ |
||
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( |
@@ -3,6 +3,9 @@ |
||
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; |
@@ -226,6 +226,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -370,8 +370,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -62,7 +62,7 @@ discard block |
||
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 |
||
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) { |
@@ -280,8 +280,7 @@ discard block |
||
280 | 280 | $delta_seconds = (int) $value; |
281 | 281 | if ($delta_seconds <= 0) { |
282 | 282 | $expiry_time = 0; |
283 | - } |
|
284 | - else { |
|
283 | + } else { |
|
285 | 284 | $expiry_time = $this->reference_time + $delta_seconds; |
286 | 285 | } |
287 | 286 | |
@@ -338,8 +337,7 @@ discard block |
||
338 | 337 | // Ignore non-associative attributes |
339 | 338 | if (is_numeric($key)) { |
340 | 339 | $parts[] = $value; |
341 | - } |
|
342 | - else { |
|
340 | + } else { |
|
343 | 341 | $parts[] = sprintf('%s=%s', $key, $value); |
344 | 342 | } |
345 | 343 | } |
@@ -385,8 +383,7 @@ discard block |
||
385 | 383 | |
386 | 384 | if (!empty($name)) { |
387 | 385 | $value = $string; |
388 | - } |
|
389 | - elseif (strpos($kvparts, '=') === false) { |
|
386 | + } elseif (strpos($kvparts, '=') === false) { |
|
390 | 387 | // Some sites might only have a value without the equals separator. |
391 | 388 | // Deviate from RFC 6265 and pretend it was actually a blank name |
392 | 389 | // (`=foo`) |
@@ -394,8 +391,7 @@ discard block |
||
394 | 391 | // https://bugzilla.mozilla.org/show_bug.cgi?id=169091 |
395 | 392 | $name = ''; |
396 | 393 | $value = $kvparts; |
397 | - } |
|
398 | - else { |
|
394 | + } else { |
|
399 | 395 | list($name, $value) = explode('=', $kvparts, 2); |
400 | 396 | } |
401 | 397 | $name = trim($name); |
@@ -409,8 +405,7 @@ discard block |
||
409 | 405 | if (strpos($part, '=') === false) { |
410 | 406 | $part_key = $part; |
411 | 407 | $part_value = true; |
412 | - } |
|
413 | - else { |
|
408 | + } else { |
|
414 | 409 | list($part_key, $part_value) = explode('=', $part, 2); |
415 | 410 | $part_value = trim($part_value); |
416 | 411 | } |
@@ -445,8 +440,7 @@ discard block |
||
445 | 440 | if (empty($parsed->attributes['domain']) && !empty($origin)) { |
446 | 441 | $parsed->attributes['domain'] = $origin->host; |
447 | 442 | $parsed->flags['host-only'] = true; |
448 | - } |
|
449 | - else { |
|
443 | + } else { |
|
450 | 444 | $parsed->flags['host-only'] = false; |
451 | 445 | } |
452 | 446 | |
@@ -460,14 +454,12 @@ discard block |
||
460 | 454 | // the uri-path is not a %x2F ("/") character, output |
461 | 455 | // %x2F ("/") and skip the remaining steps. |
462 | 456 | $path = '/'; |
463 | - } |
|
464 | - elseif (substr_count($path, '/') === 1) { |
|
457 | + } elseif (substr_count($path, '/') === 1) { |
|
465 | 458 | // If the uri-path contains no more than one %x2F ("/") |
466 | 459 | // character, output %x2F ("/") and skip the remaining |
467 | 460 | // step. |
468 | 461 | $path = '/'; |
469 | - } |
|
470 | - else { |
|
462 | + } else { |
|
471 | 463 | // Output the characters of the uri-path from the first |
472 | 464 | // character up to, but not including, the right-most |
473 | 465 | // %x2F ("/"). |
@@ -357,7 +357,7 @@ |
||
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): |
@@ -291,11 +291,9 @@ |
||
291 | 291 | # tmax if k >= bias + tmax, or k - bias otherwise |
292 | 292 | if ($k <= ($bias + self::BOOTSTRAP_TMIN)) { |
293 | 293 | $t = self::BOOTSTRAP_TMIN; |
294 | - } |
|
295 | - elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) { |
|
294 | + } elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) { |
|
296 | 295 | $t = self::BOOTSTRAP_TMAX; |
297 | - } |
|
298 | - else { |
|
296 | + } else { |
|
299 | 297 | $t = $k - $bias; |
300 | 298 | } |
301 | 299 | # if q < t then break |
@@ -249,7 +249,7 @@ discard block |
||
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 |
||
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) { |
@@ -155,8 +155,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -232,7 +232,7 @@ |
||
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) { |
@@ -249,8 +249,7 @@ |
||
249 | 249 | if (is_array($this->data)) { |
250 | 250 | $request['data'] = $this->data; |
251 | 251 | } |
252 | - } |
|
253 | - elseif (is_array($request['data']) && is_array($this->data)) { |
|
252 | + } elseif (is_array($request['data']) && is_array($this->data)) { |
|
254 | 253 | $request['data'] = array_merge($this->data, $request['data']); |
255 | 254 | } |
256 | 255 |
@@ -57,16 +57,13 @@ |
||
57 | 57 | public function __construct($args = null) { |
58 | 58 | if (is_string($args)) { |
59 | 59 | $this->proxy = $args; |
60 | - } |
|
61 | - elseif (is_array($args)) { |
|
60 | + } elseif (is_array($args)) { |
|
62 | 61 | if (count($args) == 1) { |
63 | 62 | list($this->proxy) = $args; |
64 | - } |
|
65 | - elseif (count($args) == 3) { |
|
63 | + } elseif (count($args) == 3) { |
|
66 | 64 | list($this->proxy, $this->user, $this->pass) = $args; |
67 | 65 | $this->use_authentication = true; |
68 | - } |
|
69 | - else { |
|
66 | + } else { |
|
70 | 67 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
71 | 68 | } |
72 | 69 | } |