@@ -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)) {
|
@@ -626,12 +626,12 @@ discard block |
||
| 626 | 626 | */ |
| 627 | 627 | public function post(array $fields = [], $format = 'QUERY') |
| 628 | 628 | {
|
| 629 | - $this->curlOptions[ CURLOPT_POST ] = true; |
|
| 629 | + $this->curlOptions[CURLOPT_POST] = true; |
|
| 630 | 630 | |
| 631 | 631 | if ($format === 'QUERY') {
|
| 632 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 632 | + $this->curlOptions[CURLOPT_POSTFIELDS] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 633 | 633 | } elseif ($format === 'JSON') {
|
| 634 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = json_encode($fields); |
|
| 634 | + $this->curlOptions[CURLOPT_POSTFIELDS] = json_encode($fields); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | return $this->getResponse(); |
@@ -650,11 +650,11 @@ discard block |
||
| 650 | 650 | */ |
| 651 | 651 | public function delete(array $fields = []) |
| 652 | 652 | {
|
| 653 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'DELETE'; |
|
| 653 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'DELETE'; |
|
| 654 | 654 | |
| 655 | 655 | if (count($fields)) {
|
| 656 | - $this->curlOptions[ CURLOPT_POST ] = true; |
|
| 657 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 656 | + $this->curlOptions[CURLOPT_POST] = true; |
|
| 657 | + $this->curlOptions[CURLOPT_POSTFIELDS] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); |
|
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | return $this->getResponse(); |
@@ -671,10 +671,10 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | public function head() |
| 673 | 673 | {
|
| 674 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'HEAD'; |
|
| 675 | - $this->curlOptions[ CURLOPT_HTTPGET ] = true; |
|
| 676 | - $this->curlOptions[ CURLOPT_HEADER ] = true; |
|
| 677 | - $this->curlOptions[ CURLOPT_NOBODY ] = true; |
|
| 674 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'HEAD'; |
|
| 675 | + $this->curlOptions[CURLOPT_HTTPGET] = true; |
|
| 676 | + $this->curlOptions[CURLOPT_HEADER] = true; |
|
| 677 | + $this->curlOptions[CURLOPT_NOBODY] = true; |
|
| 678 | 678 | |
| 679 | 679 | return $this->getResponse(); |
| 680 | 680 | } |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | public function trace() |
| 692 | 692 | {
|
| 693 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'TRACE'; |
|
| 693 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'TRACE'; |
|
| 694 | 694 | |
| 695 | 695 | return $this->getResponse(); |
| 696 | 696 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | */ |
| 707 | 707 | public function options() |
| 708 | 708 | {
|
| 709 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'OPTIONS'; |
|
| 709 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'OPTIONS'; |
|
| 710 | 710 | |
| 711 | 711 | return $this->getResponse(); |
| 712 | 712 | } |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | */ |
| 723 | 723 | public function patch() |
| 724 | 724 | {
|
| 725 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'PATCH'; |
|
| 725 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'PATCH'; |
|
| 726 | 726 | |
| 727 | 727 | return $this->getResponse(); |
| 728 | 728 | } |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | */ |
| 739 | 739 | public function connect() |
| 740 | 740 | {
|
| 741 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'CONNECT'; |
|
| 741 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'CONNECT'; |
|
| 742 | 742 | |
| 743 | 743 | return $this->getResponse(); |
| 744 | 744 | } |
@@ -754,9 +754,9 @@ discard block |
||
| 754 | 754 | */ |
| 755 | 755 | public function download() |
| 756 | 756 | {
|
| 757 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'DOWNLOAD'; |
|
| 758 | - $this->curlOptions[ CURLOPT_BINARYTRANSFER ] = true; |
|
| 759 | - $this->curlOptions[ CURLOPT_RETURNTRANSFER ] = false; |
|
| 757 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'DOWNLOAD'; |
|
| 758 | + $this->curlOptions[CURLOPT_BINARYTRANSFER] = true; |
|
| 759 | + $this->curlOptions[CURLOPT_RETURNTRANSFER] = false; |
|
| 760 | 760 | |
| 761 | 761 | return $this->getResponse(); |
| 762 | 762 | } |
@@ -773,11 +773,11 @@ discard block |
||
| 773 | 773 | public function getHandle() |
| 774 | 774 | {
|
| 775 | 775 | if ($this->curlAutoClose) {
|
| 776 | - $this->curlOptions[ CURLOPT_FORBID_REUSE ] = true; |
|
| 777 | - $this->curlOptions[ CURLOPT_FRESH_CONNECT ] = true; |
|
| 776 | + $this->curlOptions[CURLOPT_FORBID_REUSE] = true; |
|
| 777 | + $this->curlOptions[CURLOPT_FRESH_CONNECT] = true; |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - $this->curlOptions[ CURLOPT_URL ] = $this->uri->__toString(); |
|
| 780 | + $this->curlOptions[CURLOPT_URL] = $this->uri->__toString(); |
|
| 781 | 781 | |
| 782 | 782 | $handle = curl_init($this->uri->__toString()); |
| 783 | 783 | |