mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Move rfc2616 and rfc6265 to deferred properties.
This avoids always calling array_fill_keys() for each new instance of Curl and makes var_dump($curl); cleaner.
This commit is contained in:
+22
-2
@@ -83,6 +83,8 @@ class Curl
|
||||
|
||||
private static $deferredProperties = array(
|
||||
'effectiveUrl',
|
||||
'rfc2616',
|
||||
'rfc6265',
|
||||
'totalTime',
|
||||
);
|
||||
|
||||
@@ -110,8 +112,6 @@ class Curl
|
||||
$this->setOpt(CURLOPT_RETURNTRANSFER, true);
|
||||
$this->headers = new CaseInsensitiveArray();
|
||||
$this->setUrl($base_url);
|
||||
$this->rfc2616 = array_fill_keys(self::$RFC2616, true);
|
||||
$this->rfc6265 = array_fill_keys(self::$RFC6265, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1184,6 +1184,26 @@ class Curl
|
||||
return $this->getInfo(CURLINFO_EFFECTIVE_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RFC 2616
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __get_rfc2616()
|
||||
{
|
||||
return array_fill_keys(self::$RFC2616, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RFC 6265
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __get_rfc6265()
|
||||
{
|
||||
return array_fill_keys(self::$RFC6265, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Total Time
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user