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:
Zach Borboa
2016-11-12 08:57:58 -08:00
parent 714d072a14
commit d6f4d1a8f6
+22 -2
View File
@@ -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
*