| @@ -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 | // ------------------------------------------------------------------------ | 
| @@ -135,7 +135,7 @@ discard block | ||
| 135 | 135 | */ | 
| 136 | 136 | public function setOption($option, $value) | 
| 137 | 137 |      {
 | 
| 138 | - $this->curlOptions[ $option ] = $value; | |
| 138 | + $this->curlOptions[$option] = $value; | |
| 139 | 139 | |
| 140 | 140 | return $this; | 
| 141 | 141 | } | 
| @@ -177,7 +177,7 @@ discard block | ||
| 177 | 177 | CURL_HTTP_VERSION_2, | 
| 178 | 178 | ] | 
| 179 | 179 |          )) {
 | 
| 180 | - $this->curlOptions[ CURLOPT_HTTP_VERSION ] = $httpVersion; | |
| 180 | + $this->curlOptions[CURLOPT_HTTP_VERSION] = $httpVersion; | |
| 181 | 181 | } | 
| 182 | 182 | |
| 183 | 183 | return $this; | 
| @@ -196,7 +196,7 @@ discard block | ||
| 196 | 196 | */ | 
| 197 | 197 | public function setUserAgent($userAgent) | 
| 198 | 198 |      {
 | 
| 199 | - $this->curlOptions[ CURLOPT_USERAGENT ] = trim($userAgent); | |
| 199 | + $this->curlOptions[CURLOPT_USERAGENT] = trim($userAgent); | |
| 200 | 200 | |
| 201 | 201 | return $this; | 
| 202 | 202 | } | 
| @@ -214,7 +214,7 @@ discard block | ||
| 214 | 214 | */ | 
| 215 | 215 | public function setReferer($referer) | 
| 216 | 216 |      {
 | 
| 217 | - $this->curlOptions[ CURLOPT_REFERER ] = trim($referer); | |
| 217 | + $this->curlOptions[CURLOPT_REFERER] = trim($referer); | |
| 218 | 218 | |
| 219 | 219 | return $this; | 
| 220 | 220 | } | 
| @@ -235,9 +235,9 @@ discard block | ||
| 235 | 235 | public function setEncoding($encoding) | 
| 236 | 236 |      {
 | 
| 237 | 237 |          if (in_array($encoding, ['identity', 'deflate', 'gzip'])) {
 | 
| 238 | - $this->curlOptions[ CURLOPT_ENCODING ] = $encoding; | |
| 238 | + $this->curlOptions[CURLOPT_ENCODING] = $encoding; | |
| 239 | 239 |          } else {
 | 
| 240 | - $this->curlOptions[ CURLOPT_ENCODING ] = ''; | |
| 240 | + $this->curlOptions[CURLOPT_ENCODING] = ''; | |
| 241 | 241 | } | 
| 242 | 242 | |
| 243 | 243 | return $this; | 
| @@ -258,9 +258,9 @@ discard block | ||
| 258 | 258 | public function setTimeout($timeout, $isMilliseconds = false) | 
| 259 | 259 |      {
 | 
| 260 | 260 |          if ($isMilliseconds) {
 | 
| 261 | - $this->curlOptions[ CURLOPT_TIMEOUT_MS ] = (int)$timeout; | |
| 261 | + $this->curlOptions[CURLOPT_TIMEOUT_MS] = (int) $timeout; | |
| 262 | 262 |          } else {
 | 
| 263 | - $this->curlOptions[ CURLOPT_TIMEOUT ] = (int)$timeout; | |
| 263 | + $this->curlOptions[CURLOPT_TIMEOUT] = (int) $timeout; | |
| 264 | 264 | } | 
| 265 | 265 | |
| 266 | 266 | return $this; | 
| @@ -281,9 +281,9 @@ discard block | ||
| 281 | 281 | public function setConnectionTimeout($timeout, $isMilliseconds = false) | 
| 282 | 282 |      {
 | 
| 283 | 283 |          if ($isMilliseconds) {
 | 
| 284 | - $this->curlOptions[ CURLOPT_CONNECTTIMEOUT_MS ] = (int)$timeout; | |
| 284 | + $this->curlOptions[CURLOPT_CONNECTTIMEOUT_MS] = (int) $timeout; | |
| 285 | 285 |          } else {
 | 
| 286 | - $this->curlOptions[ CURLOPT_CONNECTTIMEOUT ] = (int)$timeout; | |
| 286 | + $this->curlOptions[CURLOPT_CONNECTTIMEOUT] = (int) $timeout; | |
| 287 | 287 | } | 
| 288 | 288 | |
| 289 | 289 | return $this; | 
| @@ -302,8 +302,8 @@ discard block | ||
| 302 | 302 | */ | 
| 303 | 303 | public function setMaximumRedirects($maximum) | 
| 304 | 304 |      {
 | 
| 305 | - $this->curlOptions[ CURLOPT_MAXREDIRS ] = (int)$maximum; | |
| 306 | - $this->curlOptions[ CURLOPT_FOLLOWLOCATION ] = true; | |
| 305 | + $this->curlOptions[CURLOPT_MAXREDIRS] = (int) $maximum; | |
| 306 | + $this->curlOptions[CURLOPT_FOLLOWLOCATION] = true; | |
| 307 | 307 | |
| 308 | 308 | return $this; | 
| 309 | 309 | } | 
| @@ -328,8 +328,8 @@ discard block | ||
| 328 | 328 |      {
 | 
| 329 | 329 |          if (is_file($caInfoFilePath)) {
 | 
| 330 | 330 | $this->setSslVerify(2, true); | 
| 331 | - $this->curlOptions[ CURLOPT_CAINFO ] = pathinfo($caInfoFilePath, PATHINFO_BASENAME); | |
| 332 | - $this->curlOptions[ CURLOPT_CAPATH ] = dirname($caInfoFilePath); | |
| 331 | + $this->curlOptions[CURLOPT_CAINFO] = pathinfo($caInfoFilePath, PATHINFO_BASENAME); | |
| 332 | + $this->curlOptions[CURLOPT_CAPATH] = dirname($caInfoFilePath); | |
| 333 | 333 | } | 
| 334 | 334 | |
| 335 | 335 | return $this; | 
| @@ -353,11 +353,11 @@ discard block | ||
| 353 | 353 | */ | 
| 354 | 354 | public function setSslVerify($verifyHost, $verifyStatus = false) | 
| 355 | 355 |      {
 | 
| 356 | - $this->curlOptions[ CURLOPT_SSL_VERIFYPEER ] = true; | |
| 356 | + $this->curlOptions[CURLOPT_SSL_VERIFYPEER] = true; | |
| 357 | 357 | |
| 358 | 358 | $verifyHost = in_array($verifyHost, range(0, 3)) ? $verifyHost : 0; | 
| 359 | - $this->curlOptions[ CURLOPT_SSL_VERIFYHOST ] = (int)$verifyHost; | |
| 360 | - $this->curlOptions[ CURLOPT_SSL_VERIFYSTATUS ] = (bool)$verifyStatus; | |
| 359 | + $this->curlOptions[CURLOPT_SSL_VERIFYHOST] = (int) $verifyHost; | |
| 360 | + $this->curlOptions[CURLOPT_SSL_VERIFYSTATUS] = (bool) $verifyStatus; | |
| 361 | 361 | |
| 362 | 362 | return $this; | 
| 363 | 363 | } | 
| @@ -384,11 +384,11 @@ discard block | ||
| 384 | 384 | public function setAuthentication($username = '', $password = '', $method = CURLAUTH_ANY) | 
| 385 | 385 |      {
 | 
| 386 | 386 |          if (defined('CURLOPT_USERNAME')) {
 | 
| 387 | - $this->curlOptions[ CURLOPT_USERNAME ] = $username; | |
| 387 | + $this->curlOptions[CURLOPT_USERNAME] = $username; | |
| 388 | 388 | } | 
| 389 | 389 | |
| 390 | - $this->curlOptions[ CURLOPT_USERPWD ] = "$username:$password"; | |
| 391 | - $this->curlOptions[ CURLOPT_HTTPAUTH ] = CURLAUTH_ANY; | |
| 390 | + $this->curlOptions[CURLOPT_USERPWD] = "$username:$password"; | |
| 391 | + $this->curlOptions[CURLOPT_HTTPAUTH] = CURLAUTH_ANY; | |
| 392 | 392 | |
| 393 | 393 | if (in_array($method, [ | 
| 394 | 394 | CURLAUTH_BASIC, | 
| @@ -398,7 +398,7 @@ discard block | ||
| 398 | 398 | CURLAUTH_ANY, | 
| 399 | 399 | CURLAUTH_ANYSAFE, | 
| 400 | 400 |          ])) {
 | 
| 401 | - $this->curlOptions[ CURLOPT_HTTPAUTH ] = $method; | |
| 401 | + $this->curlOptions[CURLOPT_HTTPAUTH] = $method; | |
| 402 | 402 | } | 
| 403 | 403 | |
| 404 | 404 | return $this; | 
| @@ -425,10 +425,10 @@ discard block | ||
| 425 | 425 | */ | 
| 426 | 426 | public function setProxy($address, $port = 1080, $type = CURLPROXY_HTTP) | 
| 427 | 427 |      {
 | 
| 428 | - $this->curlOptions[ CURLOPT_PROXY ] = $address; | |
| 429 | - $this->curlOptions[ CURLOPT_PROXYPORT ] = $port; | |
| 430 | - $this->curlOptions[ CURLOPT_PROXYTYPE ] = $type; | |
| 431 | - $this->curlOptions[ CURLOPT_HTTPPROXYTUNNEL ] = true; | |
| 428 | + $this->curlOptions[CURLOPT_PROXY] = $address; | |
| 429 | + $this->curlOptions[CURLOPT_PROXYPORT] = $port; | |
| 430 | + $this->curlOptions[CURLOPT_PROXYTYPE] = $type; | |
| 431 | + $this->curlOptions[CURLOPT_HTTPPROXYTUNNEL] = true; | |
| 432 | 432 | |
| 433 | 433 | return $this; | 
| 434 | 434 | } | 
| @@ -451,16 +451,16 @@ discard block | ||
| 451 | 451 | public function setProxyAuthentication($username, $password, $method = CURLAUTH_BASIC) | 
| 452 | 452 |      {
 | 
| 453 | 453 |          if (array_key_exists(CURLOPT_HTTPPROXYTUNNEL, $this->curlOptions)) {
 | 
| 454 | - $this->curlOptions[ CURLOPT_PROXYUSERPWD ] = "$username:$password"; | |
| 454 | + $this->curlOptions[CURLOPT_PROXYUSERPWD] = "$username:$password"; | |
| 455 | 455 | } | 
| 456 | 456 | |
| 457 | - $this->curlOptions[ CURLOPT_PROXYAUTH ] = CURLAUTH_BASIC; | |
| 457 | + $this->curlOptions[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC; | |
| 458 | 458 | |
| 459 | 459 | if (in_array($method, [ | 
| 460 | 460 | CURLAUTH_BASIC, | 
| 461 | 461 | CURLAUTH_NTLM, | 
| 462 | 462 |          ])) {
 | 
| 463 | - $this->curlOptions[ CURLOPT_PROXYAUTH ] = $method; | |
| 463 | + $this->curlOptions[CURLOPT_PROXYAUTH] = $method; | |
| 464 | 464 | } | 
| 465 | 465 | |
| 466 | 466 | return $this; | 
| @@ -500,7 +500,7 @@ discard block | ||
| 500 | 500 | */ | 
| 501 | 501 | public function addHeader($name, $value) | 
| 502 | 502 |      {
 | 
| 503 | - $this->curlHeaders[ $name ] = $value; | |
| 503 | + $this->curlHeaders[$name] = $value; | |
| 504 | 504 | |
| 505 | 505 | return $this; | 
| 506 | 506 | } | 
| @@ -520,7 +520,7 @@ discard block | ||
| 520 | 520 | */ | 
| 521 | 521 | public function setCookie($cookie) | 
| 522 | 522 |      {
 | 
| 523 | - $this->curlOptions[ CURLOPT_COOKIE ] = $cookie; | |
| 523 | + $this->curlOptions[CURLOPT_COOKIE] = $cookie; | |
| 524 | 524 | |
| 525 | 525 | return $this; | 
| 526 | 526 | } | 
| @@ -542,8 +542,8 @@ discard block | ||
| 542 | 542 |      {
 | 
| 543 | 543 |          if (is_file($cookieFile)) {
 | 
| 544 | 544 | $cookieJar = empty($cookieJar) ? $cookieFile : $cookieJar; | 
| 545 | - $this->curlOptions[ CURLOPT_COOKIEFILE ] = $cookieFile; | |
| 546 | - $this->curlOptions[ CURLOPT_COOKIEJAR ] = $cookieJar; | |
| 545 | + $this->curlOptions[CURLOPT_COOKIEFILE] = $cookieFile; | |
| 546 | + $this->curlOptions[CURLOPT_COOKIEJAR] = $cookieJar; | |
| 547 | 547 | } | 
| 548 | 548 | |
| 549 | 549 | return $this; | 
| @@ -562,7 +562,7 @@ discard block | ||
| 562 | 562 |      {
 | 
| 563 | 563 | $this->uri = $this->uri->withQuery($query); | 
| 564 | 564 | |
| 565 | - $this->curlOptions[ CURLOPT_HTTPGET ] = true; | |
| 565 | + $this->curlOptions[CURLOPT_HTTPGET] = true; | |
| 566 | 566 | |
| 567 | 567 | return $this->getResponse(); | 
| 568 | 568 | } | 
| @@ -578,7 +578,7 @@ discard block | ||
| 578 | 578 | */ | 
| 579 | 579 | public function getResponse() | 
| 580 | 580 |      {
 | 
| 581 | -        if(array_key_exists(CURLOPT_URL, $this->curlOptions)) {
 | |
| 581 | +        if (array_key_exists(CURLOPT_URL, $this->curlOptions)) {
 | |
| 582 | 582 | $handle = curl_init(); | 
| 583 | 583 |          } else {
 | 
| 584 | 584 | $handle = curl_init($this->uri->__toString()); | 
| @@ -590,7 +590,7 @@ discard block | ||
| 590 | 590 | $headers[] = trim($key) . ': ' . trim($value); | 
| 591 | 591 | } | 
| 592 | 592 | |
| 593 | - $this->curlOptions[ CURLOPT_HTTPHEADER ] = $headers; | |
| 593 | + $this->curlOptions[CURLOPT_HTTPHEADER] = $headers; | |
| 594 | 594 | } | 
| 595 | 595 | |
| 596 | 596 |          if (curl_setopt_array($handle, $this->curlOptions)) {
 | 
| @@ -619,8 +619,8 @@ discard block | ||
| 619 | 619 | */ | 
| 620 | 620 | public function post(array $fields = []) | 
| 621 | 621 |      {
 | 
| 622 | - $this->curlOptions[ CURLOPT_POST ] = true; | |
| 623 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); | |
| 622 | + $this->curlOptions[CURLOPT_POST] = true; | |
| 623 | + $this->curlOptions[CURLOPT_POSTFIELDS] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); | |
| 624 | 624 | |
| 625 | 625 | return $this->getResponse(); | 
| 626 | 626 | } | 
| @@ -636,11 +636,11 @@ discard block | ||
| 636 | 636 | */ | 
| 637 | 637 | public function delete(array $fields = []) | 
| 638 | 638 |      {
 | 
| 639 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'DELETE'; | |
| 639 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'DELETE'; | |
| 640 | 640 | |
| 641 | 641 |          if (count($fields)) {
 | 
| 642 | - $this->curlOptions[ CURLOPT_POST ] = true; | |
| 643 | - $this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); | |
| 642 | + $this->curlOptions[CURLOPT_POST] = true; | |
| 643 | + $this->curlOptions[CURLOPT_POSTFIELDS] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986); | |
| 644 | 644 | } | 
| 645 | 645 | |
| 646 | 646 | return $this->getResponse(); | 
| @@ -655,10 +655,10 @@ discard block | ||
| 655 | 655 | */ | 
| 656 | 656 | public function head() | 
| 657 | 657 |      {
 | 
| 658 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'HEAD'; | |
| 659 | - $this->curlOptions[ CURLOPT_HTTPGET ] = true; | |
| 660 | - $this->curlOptions[ CURLOPT_HEADER ] = true; | |
| 661 | - $this->curlOptions[ CURLOPT_NOBODY ] = true; | |
| 658 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'HEAD'; | |
| 659 | + $this->curlOptions[CURLOPT_HTTPGET] = true; | |
| 660 | + $this->curlOptions[CURLOPT_HEADER] = true; | |
| 661 | + $this->curlOptions[CURLOPT_NOBODY] = true; | |
| 662 | 662 | |
| 663 | 663 | return $this->getResponse(); | 
| 664 | 664 | } | 
| @@ -672,7 +672,7 @@ discard block | ||
| 672 | 672 | */ | 
| 673 | 673 | public function trace() | 
| 674 | 674 |      {
 | 
| 675 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'TRACE'; | |
| 675 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'TRACE'; | |
| 676 | 676 | |
| 677 | 677 | return $this->getResponse(); | 
| 678 | 678 | } | 
| @@ -686,7 +686,7 @@ discard block | ||
| 686 | 686 | */ | 
| 687 | 687 | public function options() | 
| 688 | 688 |      {
 | 
| 689 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'OPTIONS'; | |
| 689 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'OPTIONS'; | |
| 690 | 690 | } | 
| 691 | 691 | |
| 692 | 692 | // ------------------------------------------------------------------------ | 
| @@ -698,7 +698,7 @@ discard block | ||
| 698 | 698 | */ | 
| 699 | 699 | public function patch() | 
| 700 | 700 |      {
 | 
| 701 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'PATCH'; | |
| 701 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'PATCH'; | |
| 702 | 702 | |
| 703 | 703 | return $this->getResponse(); | 
| 704 | 704 | } | 
| @@ -712,7 +712,7 @@ discard block | ||
| 712 | 712 | */ | 
| 713 | 713 | public function connect() | 
| 714 | 714 |      {
 | 
| 715 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'CONNECT'; | |
| 715 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'CONNECT'; | |
| 716 | 716 | |
| 717 | 717 | return $this->getResponse(); | 
| 718 | 718 | } | 
| @@ -726,9 +726,9 @@ discard block | ||
| 726 | 726 | */ | 
| 727 | 727 | public function download() | 
| 728 | 728 |      {
 | 
| 729 | - $this->curlOptions[ CURLOPT_CUSTOMREQUEST ] = 'DOWNLOAD'; | |
| 730 | - $this->curlOptions[ CURLOPT_BINARYTRANSFER ] = true; | |
| 731 | - $this->curlOptions[ CURLOPT_RETURNTRANSFER ] = false; | |
| 729 | + $this->curlOptions[CURLOPT_CUSTOMREQUEST] = 'DOWNLOAD'; | |
| 730 | + $this->curlOptions[CURLOPT_BINARYTRANSFER] = true; | |
| 731 | + $this->curlOptions[CURLOPT_RETURNTRANSFER] = false; | |
| 732 | 732 | |
| 733 | 733 | return $this->getResponse(); | 
| 734 | 734 | } | 
| @@ -745,11 +745,11 @@ discard block | ||
| 745 | 745 | public function getHandle() | 
| 746 | 746 |      {
 | 
| 747 | 747 |          if ($this->curlAutoClose) {
 | 
| 748 | - $this->curlOptions[ CURLOPT_FORBID_REUSE ] = true; | |
| 749 | - $this->curlOptions[ CURLOPT_FRESH_CONNECT ] = true; | |
| 748 | + $this->curlOptions[CURLOPT_FORBID_REUSE] = true; | |
| 749 | + $this->curlOptions[CURLOPT_FRESH_CONNECT] = true; | |
| 750 | 750 | } | 
| 751 | 751 | |
| 752 | - $this->curlOptions[ CURLOPT_URL ] = $this->uri->__toString(); | |
| 752 | + $this->curlOptions[CURLOPT_URL] = $this->uri->__toString(); | |
| 753 | 753 | |
| 754 | 754 | $handle = curl_init($this->uri->__toString()); | 
| 755 | 755 | |