@@ -75,28 +75,28 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // default, TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly. |
| 78 | - $this->curlOptions[ CURLOPT_RETURNTRANSFER ] = true; |
|
| 78 | + $this->curlOptions[CURLOPT_RETURNTRANSFER] = true; |
|
| 79 | 79 | |
| 80 | 80 | // default, TRUE to output verbose information. |
| 81 | - $this->curlOptions[ CURLOPT_VERBOSE ] = true; |
|
| 81 | + $this->curlOptions[CURLOPT_VERBOSE] = true; |
|
| 82 | 82 | |
| 83 | 83 | // default, TRUE to include the header in the output. |
| 84 | - $this->curlOptions[ CURLOPT_HEADER ] = true; |
|
| 84 | + $this->curlOptions[CURLOPT_HEADER] = true; |
|
| 85 | 85 | |
| 86 | 86 | // default, lets CURL decide which version to use. |
| 87 | - $this->curlOptions[ CURLOPT_HTTP_VERSION ] = CURL_HTTP_VERSION_NONE; |
|
| 87 | + $this->curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_NONE; |
|
| 88 | 88 | |
| 89 | 89 | // default, http user agent using o2system curl. |
| 90 | - $this->curlOptions[ CURLOPT_USERAGENT ] = 'Curl/1.0 (O2System)'; |
|
| 90 | + $this->curlOptions[CURLOPT_USERAGENT] = 'Curl/1.0 (O2System)'; |
|
| 91 | 91 | |
| 92 | 92 | // default, TRUE to automatically set the Referer: field in requests where it follows a Location: redirect. |
| 93 | - $this->curlOptions[ CURLOPT_AUTOREFERER ] = true; |
|
| 93 | + $this->curlOptions[CURLOPT_AUTOREFERER] = true; |
|
| 94 | 94 | |
| 95 | 95 | // default, FALSE to stop cURL from verifying the peer's certificate. |
| 96 | - $this->curlOptions[ CURLOPT_SSL_VERIFYPEER ] = false; |
|
| 96 | + $this->curlOptions[CURLOPT_SSL_VERIFYPEER] = false; |
|
| 97 | 97 | |
| 98 | 98 | // default, 0 to not check the names. |
| 99 | - $this->curlOptions[ CURLOPT_SSL_VERIFYHOST ] = 0; |
|
| 99 | + $this->curlOptions[CURLOPT_SSL_VERIFYHOST] = 0; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // ------------------------------------------------------------------------ |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function setOption($option, $value) |
| 139 | 139 | {
|
| 140 | - $this->curlOptions[ $option ] = $value; |
|
| 140 | + $this->curlOptions[$option] = $value; |
|
| 141 | 141 | |
| 142 | 142 | return $this; |
| 143 | 143 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | CURL_HTTP_VERSION_2, |
| 180 | 180 | ] |
| 181 | 181 | )) {
|
| 182 | - $this->curlOptions[ CURLOPT_HTTP_VERSION ] = $httpVersion; |
|
| 182 | + $this->curlOptions[CURLOPT_HTTP_VERSION] = $httpVersion; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return $this; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function setUserAgent($userAgent) |
| 200 | 200 | {
|
| 201 | - $this->curlOptions[ CURLOPT_USERAGENT ] = trim($userAgent); |
|
| 201 | + $this->curlOptions[CURLOPT_USERAGENT] = trim($userAgent); |
|
| 202 | 202 | |
| 203 | 203 | return $this; |
| 204 | 204 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function setReferer($referer) |
| 218 | 218 | {
|
| 219 | - $this->curlOptions[ CURLOPT_REFERER ] = trim($referer); |
|
| 219 | + $this->curlOptions[CURLOPT_REFERER] = trim($referer); |
|
| 220 | 220 | |
| 221 | 221 | return $this; |
| 222 | 222 | } |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | public function setEncoding($encoding) |
| 238 | 238 | {
|
| 239 | 239 | if (in_array($encoding, ['identity', 'deflate', 'gzip'])) {
|
| 240 | - $this->curlOptions[ CURLOPT_ENCODING ] = $encoding; |
|
| 240 | + $this->curlOptions[CURLOPT_ENCODING] = $encoding; |
|
| 241 | 241 | } else {
|
| 242 | - $this->curlOptions[ CURLOPT_ENCODING ] = ''; |
|
| 242 | + $this->curlOptions[CURLOPT_ENCODING] = ''; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | return $this; |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | public function setTimeout($timeout, $isMilliseconds = false) |
| 261 | 261 | {
|
| 262 | 262 | if ($isMilliseconds) {
|
| 263 | - $this->curlOptions[ CURLOPT_TIMEOUT_MS ] = (int)$timeout; |
|
| 263 | + $this->curlOptions[CURLOPT_TIMEOUT_MS] = (int) $timeout; |
|
| 264 | 264 | } else {
|
| 265 | - $this->curlOptions[ CURLOPT_TIMEOUT ] = (int)$timeout; |
|
| 265 | + $this->curlOptions[CURLOPT_TIMEOUT] = (int) $timeout; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | return $this; |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | public function setConnectionTimeout($timeout, $isMilliseconds = false) |
| 284 | 284 | {
|
| 285 | 285 | if ($isMilliseconds) {
|
| 286 | - $this->curlOptions[ CURLOPT_CONNECTTIMEOUT_MS ] = (int)$timeout; |
|
| 286 | + $this->curlOptions[CURLOPT_CONNECTTIMEOUT_MS] = (int) $timeout; |
|
| 287 | 287 | } else {
|
| 288 | - $this->curlOptions[ CURLOPT_CONNECTTIMEOUT ] = (int)$timeout; |
|
| 288 | + $this->curlOptions[CURLOPT_CONNECTTIMEOUT] = (int) $timeout; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | return $this; |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function setMaximumRedirects($maximum) |
| 306 | 306 | {
|
| 307 | - $this->curlOptions[ CURLOPT_MAXREDIRS ] = (int)$maximum; |
|
| 308 | - $this->curlOptions[ CURLOPT_FOLLOWLOCATION ] = true; |
|
| 307 | + $this->curlOptions[CURLOPT_MAXREDIRS] = (int) $maximum; |
|
| 308 | + $this->curlOptions[CURLOPT_FOLLOWLOCATION] = true; |
|
| 309 | 309 | |
| 310 | 310 | return $this; |
| 311 | 311 | } |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | {
|
| 331 | 331 | if (is_file($caInfoFilePath)) {
|
| 332 | 332 | $this->setSslVerify(2, true); |
| 333 | - $this->curlOptions[ CURLOPT_CAINFO ] = pathinfo($caInfoFilePath, PATHINFO_BASENAME); |
|
| 334 | - $this->curlOptions[ CURLOPT_CAPATH ] = dirname($caInfoFilePath); |
|
| 333 | + $this->curlOptions[CURLOPT_CAINFO] = pathinfo($caInfoFilePath, PATHINFO_BASENAME); |
|
| 334 | + $this->curlOptions[CURLOPT_CAPATH] = dirname($caInfoFilePath); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return $this; |
@@ -355,11 +355,11 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | public function setSslVerify($verifyHost, $verifyStatus = false) |
| 357 | 357 | {
|
| 358 | - $this->curlOptions[ CURLOPT_SSL_VERIFYPEER ] = true; |
|
| 358 | + $this->curlOptions[CURLOPT_SSL_VERIFYPEER] = true; |
|
| 359 | 359 | |
| 360 | 360 | $verifyHost = in_array($verifyHost, range(0, 3)) ? $verifyHost : 0; |
| 361 | - $this->curlOptions[ CURLOPT_SSL_VERIFYHOST ] = (int)$verifyHost; |
|
| 362 | - $this->curlOptions[ CURLOPT_SSL_VERIFYSTATUS ] = (bool)$verifyStatus; |
|
| 361 | + $this->curlOptions[CURLOPT_SSL_VERIFYHOST] = (int) $verifyHost; |
|
| 362 | + $this->curlOptions[CURLOPT_SSL_VERIFYSTATUS] = (bool) $verifyStatus; |
|
| 363 | 363 | |
| 364 | 364 | return $this; |
| 365 | 365 | } |
@@ -386,11 +386,11 @@ discard block |
||
| 386 | 386 | public function setAuthentication($username = '', $password = '', $method = CURLAUTH_ANY) |
| 387 | 387 | {
|
| 388 | 388 | if (defined('CURLOPT_USERNAME')) {
|
| 389 | - $this->curlOptions[ CURLOPT_USERNAME ] = $username; |
|
| 389 | + $this->curlOptions[CURLOPT_USERNAME] = $username; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - $this->curlOptions[ CURLOPT_USERPWD ] = "$username:$password"; |
|
| 393 | - $this->curlOptions[ CURLOPT_HTTPAUTH ] = CURLAUTH_ANY; |
|
| 392 | + $this->curlOptions[CURLOPT_USERPWD] = "$username:$password"; |
|
| 393 | + $this->curlOptions[CURLOPT_HTTPAUTH] = CURLAUTH_ANY; |
|
| 394 | 394 | |
| 395 | 395 | if (in_array($method, [ |
| 396 | 396 | CURLAUTH_BASIC, |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | CURLAUTH_ANY, |
| 401 | 401 | CURLAUTH_ANYSAFE, |
| 402 | 402 | ])) {
|
| 403 | - $this->curlOptions[ CURLOPT_HTTPAUTH ] = $method; |
|
| 403 | + $this->curlOptions[CURLOPT_HTTPAUTH] = $method; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | return $this; |
@@ -427,10 +427,10 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function setProxy($address, $port = 1080, $type = CURLPROXY_HTTP) |
| 429 | 429 | {
|
| 430 | - $this->curlOptions[ CURLOPT_PROXY ] = $address; |
|
| 431 | - $this->curlOptions[ CURLOPT_PROXYPORT ] = $port; |
|
| 432 | - $this->curlOptions[ CURLOPT_PROXYTYPE ] = $type; |
|
| 433 | - $this->curlOptions[ CURLOPT_HTTPPROXYTUNNEL ] = true; |
|
| 430 | + $this->curlOptions[CURLOPT_PROXY] = $address; |
|
| 431 | + $this->curlOptions[CURLOPT_PROXYPORT] = $port; |
|
| 432 | + $this->curlOptions[CURLOPT_PROXYTYPE] = $type; |
|
| 433 | + $this->curlOptions[CURLOPT_HTTPPROXYTUNNEL] = true; |
|
| 434 | 434 | |
| 435 | 435 | return $this; |
| 436 | 436 | } |
@@ -453,16 +453,16 @@ discard block |
||
| 453 | 453 | public function setProxyAuthentication($username, $password, $method = CURLAUTH_BASIC) |
| 454 | 454 | {
|
| 455 | 455 | if (array_key_exists(CURLOPT_HTTPPROXYTUNNEL, $this->curlOptions)) {
|
| 456 | - $this->curlOptions[ CURLOPT_PROXYUSERPWD ] = "$username:$password"; |
|
| 456 | + $this->curlOptions[CURLOPT_PROXYUSERPWD] = "$username:$password"; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - $this->curlOptions[ CURLOPT_PROXYAUTH ] = CURLAUTH_BASIC; |
|
| 459 | + $this->curlOptions[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC; |
|
| 460 | 460 | |
| 461 | 461 | if (in_array($method, [ |
| 462 | 462 | CURLAUTH_BASIC, |
| 463 | 463 | CURLAUTH_NTLM, |
| 464 | 464 | ])) {
|
| 465 | - $this->curlOptions[ CURLOPT_PROXYAUTH ] = $method; |
|
| 465 | + $this->curlOptions[CURLOPT_PROXYAUTH] = $method; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | return $this; |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | public function addHeader($name, $value) |
| 504 | 504 | {
|
| 505 | - $this->curlHeaders[ $name ] = $value; |
|
| 505 | + $this->curlHeaders[$name] = $value; |
|
| 506 | 506 | |
| 507 | 507 | return $this; |
| 508 | 508 | } |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function setCookie($cookie) |
| 524 | 524 | {
|
| 525 | - $this->curlOptions[ CURLOPT_COOKIE ] = $cookie; |
|
| 525 | + $this->curlOptions[CURLOPT_COOKIE] = $cookie; |
|
| 526 | 526 | |
| 527 | 527 | return $this; |
| 528 | 528 | } |
@@ -544,8 +544,8 @@ discard block |
||
| 544 | 544 | {
|
| 545 | 545 | if (is_file($cookieFile)) {
|
| 546 | 546 | $cookieJar = empty($cookieJar) ? $cookieFile : $cookieJar; |
| 547 | - $this->curlOptions[ CURLOPT_COOKIEFILE ] = $cookieFile; |
|
| 548 | - $this->curlOptions[ CURLOPT_COOKIEJAR ] = $cookieJar; |
|
| 547 | + $this->curlOptions[CURLOPT_COOKIEFILE] = $cookieFile; |
|
| 548 | + $this->curlOptions[CURLOPT_COOKIEJAR] = $cookieJar; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | return $this; |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | {
|
| 567 | 567 | $this->uri = $this->uri->withQuery($query); |
| 568 | 568 | |
| 569 | - $this->curlOptions[ CURLOPT_HTTPGET ] = true; |
|
| 569 | + $this->curlOptions[CURLOPT_HTTPGET] = true; |
|
| 570 | 570 | |
| 571 | 571 | return $this->getResponse(); |
| 572 | 572 | } |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $headers[] = trim($key) . ': ' . trim($value); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - $this->curlOptions[ CURLOPT_HTTPHEADER ] = $headers; |
|
| 597 | + $this->curlOptions[CURLOPT_HTTPHEADER] = $headers; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | if (curl_setopt_array($handle, $this->curlOptions)) {
|
@@ -625,8 +625,8 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function post(array $fields = []) |
| 627 | 627 | {
|
| 628 | - $this->curlOptions[ CURLOPT_POST ] = true; |
|
| 629 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 628 | + $this->curlOptions[CURLOPT_POST] = true; |
|
| 629 | + $this->curlOptions[CURLOPT_POSTFIELDS] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 630 | 630 | |
| 631 | 631 | return $this->getResponse(); |
| 632 | 632 | } |
@@ -644,11 +644,11 @@ discard block |
||
| 644 | 644 | */ |
| 645 | 645 | public function delete(array $fields = []) |
| 646 | 646 | {
|
| 647 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'DELETE'; |
|
| 647 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'DELETE'; |
|
| 648 | 648 | |
| 649 | 649 | if (count($fields)) {
|
| 650 | - $this->curlOptions[ CURLOPT_POST ] = true; |
|
| 651 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 650 | + $this->curlOptions[CURLOPT_POST] = true; |
|
| 651 | + $this->curlOptions[CURLOPT_POSTFIELDS] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | return $this->getResponse(); |
@@ -665,10 +665,10 @@ discard block |
||
| 665 | 665 | */ |
| 666 | 666 | public function head() |
| 667 | 667 | {
|
| 668 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'HEAD'; |
|
| 669 | - $this->curlOptions[ CURLOPT_HTTPGET ] = true; |
|
| 670 | - $this->curlOptions[ CURLOPT_HEADER ] = true; |
|
| 671 | - $this->curlOptions[ CURLOPT_NOBODY ] = true; |
|
| 668 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'HEAD'; |
|
| 669 | + $this->curlOptions[CURLOPT_HTTPGET] = true; |
|
| 670 | + $this->curlOptions[CURLOPT_HEADER] = true; |
|
| 671 | + $this->curlOptions[CURLOPT_NOBODY] = true; |
|
| 672 | 672 | |
| 673 | 673 | return $this->getResponse(); |
| 674 | 674 | } |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | */ |
| 685 | 685 | public function trace() |
| 686 | 686 | {
|
| 687 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'TRACE'; |
|
| 687 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'TRACE'; |
|
| 688 | 688 | |
| 689 | 689 | return $this->getResponse(); |
| 690 | 690 | } |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | */ |
| 701 | 701 | public function options() |
| 702 | 702 | {
|
| 703 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'OPTIONS'; |
|
| 703 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'OPTIONS'; |
|
| 704 | 704 | |
| 705 | 705 | return $this->getResponse(); |
| 706 | 706 | } |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | */ |
| 717 | 717 | public function patch() |
| 718 | 718 | {
|
| 719 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'PATCH'; |
|
| 719 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'PATCH'; |
|
| 720 | 720 | |
| 721 | 721 | return $this->getResponse(); |
| 722 | 722 | } |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | */ |
| 733 | 733 | public function connect() |
| 734 | 734 | {
|
| 735 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'CONNECT'; |
|
| 735 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'CONNECT'; |
|
| 736 | 736 | |
| 737 | 737 | return $this->getResponse(); |
| 738 | 738 | } |
@@ -748,9 +748,9 @@ discard block |
||
| 748 | 748 | */ |
| 749 | 749 | public function download() |
| 750 | 750 | {
|
| 751 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'DOWNLOAD'; |
|
| 752 | - $this->curlOptions[ CURLOPT_BINARYTRANSFER ] = true; |
|
| 753 | - $this->curlOptions[ CURLOPT_RETURNTRANSFER ] = false; |
|
| 751 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'DOWNLOAD'; |
|
| 752 | + $this->curlOptions[CURLOPT_BINARYTRANSFER] = true; |
|
| 753 | + $this->curlOptions[CURLOPT_RETURNTRANSFER] = false; |
|
| 754 | 754 | |
| 755 | 755 | return $this->getResponse(); |
| 756 | 756 | } |
@@ -767,11 +767,11 @@ discard block |
||
| 767 | 767 | public function getHandle() |
| 768 | 768 | {
|
| 769 | 769 | if ($this->curlAutoClose) {
|
| 770 | - $this->curlOptions[ CURLOPT_FORBID_REUSE ] = true; |
|
| 771 | - $this->curlOptions[ CURLOPT_FRESH_CONNECT ] = true; |
|
| 770 | + $this->curlOptions[CURLOPT_FORBID_REUSE] = true; |
|
| 771 | + $this->curlOptions[CURLOPT_FRESH_CONNECT] = true; |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - $this->curlOptions[ CURLOPT_URL ] = $this->uri->__toString(); |
|
| 774 | + $this->curlOptions[CURLOPT_URL] = $this->uri->__toString(); |
|
| 775 | 775 | |
| 776 | 776 | $handle = curl_init($this->uri->__toString()); |
| 777 | 777 | |