Skip to content

Commit d6f4d1a

Browse files
committed
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.
1 parent 714d072 commit d6f4d1a

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/Curl/Curl.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class Curl
8383

8484
private static $deferredProperties = array(
8585
'effectiveUrl',
86+
'rfc2616',
87+
'rfc6265',
8688
'totalTime',
8789
);
8890

@@ -110,8 +112,6 @@ public function __construct($base_url = null)
110112
$this->setOpt(CURLOPT_RETURNTRANSFER, true);
111113
$this->headers = new CaseInsensitiveArray();
112114
$this->setUrl($base_url);
113-
$this->rfc2616 = array_fill_keys(self::$RFC2616, true);
114-
$this->rfc6265 = array_fill_keys(self::$RFC6265, true);
115115
}
116116

117117
/**
@@ -1184,6 +1184,26 @@ private function __get_effectiveUrl()
11841184
return $this->getInfo(CURLINFO_EFFECTIVE_URL);
11851185
}
11861186

1187+
/**
1188+
* Get RFC 2616
1189+
*
1190+
* @access private
1191+
*/
1192+
private function __get_rfc2616()
1193+
{
1194+
return array_fill_keys(self::$RFC2616, true);
1195+
}
1196+
1197+
/**
1198+
* Get RFC 6265
1199+
*
1200+
* @access private
1201+
*/
1202+
private function __get_rfc6265()
1203+
{
1204+
return array_fill_keys(self::$RFC6265, true);
1205+
}
1206+
11871207
/**
11881208
* Get Total Time
11891209
*

0 commit comments

Comments
 (0)