Rename variable

This commit is contained in:
Zach Borboa
2022-03-10 07:54:13 -08:00
parent 1b64ab6e84
commit dc4d0db091
2 changed files with 14 additions and 14 deletions
+8 -8
View File
@@ -13,7 +13,7 @@ class MultiCurl
public $startTime = null;
public $stopTime = null;
private $curls = [];
private $queuedCurls = [];
private $activeCurls = [];
private $isStarted = false;
private $currentStartTime = null;
@@ -389,7 +389,7 @@ class MultiCurl
*/
public function close()
{
foreach ($this->curls as $curl) {
foreach ($this->queuedCurls as $curl) {
$curl->close();
}
@@ -738,7 +738,7 @@ class MultiCurl
// existing instances when they have not already been set to avoid
// unexpectedly changing the request url after is has been specified.
if ($option === CURLOPT_URL) {
foreach ($this->curls as $curl_id => $curl) {
foreach ($this->queuedCurls as $curl_id => $curl) {
if (!isset($this->instanceSpecificOptions[$curl_id][$option]) ||
$this->instanceSpecificOptions[$curl_id][$option] === null) {
$this->instanceSpecificOptions[$curl_id][$option] = $value;
@@ -948,7 +948,7 @@ class MultiCurl
$this->currentRequestCount = 0;
do {
while (count($this->curls) &&
while (count($this->queuedCurls) &&
count($this->activeCurls) < $this->concurrency &&
(!$this->rateLimitEnabled || $this->hasRequestQuota())
) {
@@ -1009,7 +1009,7 @@ class MultiCurl
}
}
}
} while ($active || count($this->activeCurls) || count($this->curls));
} while ($active || count($this->activeCurls) || count($this->queuedCurls));
$this->isStarted = false;
$this->stopTime = microtime(true);
@@ -1138,7 +1138,7 @@ class MultiCurl
*/
private function updateHeaders()
{
foreach ($this->curls as $curl) {
foreach ($this->queuedCurls as $curl) {
$curl->setHeaders($this->headers);
}
}
@@ -1154,7 +1154,7 @@ class MultiCurl
// Use sequential ids to allow for ordered post processing.
$curl->id = $this->nextCurlId++;
$curl->childOfMultiCurl = true;
$this->curls[$curl->id] = $curl;
$this->queuedCurls[$curl->id] = $curl;
$curl->setHeaders($this->headers);
}
@@ -1168,7 +1168,7 @@ class MultiCurl
*/
private function initHandle()
{
$curl = array_shift($this->curls);
$curl = array_shift($this->queuedCurls);
if ($curl === null) {
return;
}
+6 -6
View File
@@ -3471,10 +3471,10 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
$get_2 = $multi_curl->addGet(Test::TEST_URL);
$get_3 = $multi_curl->addGet(Test::TEST_URL);
// Make MultiCurl::curls accessible and MultiCurl::initHandle()
// Make MultiCurl::queuedCurls accessible and MultiCurl::initHandle()
// callable.
$reflector = new \ReflectionClass('\Curl\MultiCurl');
$property = $reflector->getProperty('curls');
$property = $reflector->getProperty('queuedCurls');
$property->setAccessible(true);
$multi_curl_curls = $property->getValue($multi_curl);
$multi_curl_initHandle = $reflector->getMethod('initHandle');
@@ -3511,10 +3511,10 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
$get_2->setProxy('example.com:9999');
$get_3 = $multi_curl->addGet(Test::TEST_URL);
// Make MultiCurl::curls accessible and MultiCurl::initHandle()
// Make MultiCurl::queuedCurls accessible and MultiCurl::initHandle()
// callable.
$reflector = new \ReflectionClass('\Curl\MultiCurl');
$property = $reflector->getProperty('curls');
$property = $reflector->getProperty('queuedCurls');
$property->setAccessible(true);
$multi_curl_curls = $property->getValue($multi_curl);
$multi_curl_initHandle = $reflector->getMethod('initHandle');
@@ -4649,7 +4649,7 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
]);
$multi_curl->addGet(Test::TEST_URL);
$curls = \Helper\get_multi_curl_property_value($multi_curl, 'curls');
$curls = \Helper\get_multi_curl_property_value($multi_curl, 'queuedCurls');
foreach ($curls as $curl) {
$this->assertEquals([
'Key1: Value1',
@@ -4713,7 +4713,7 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
]);
$multi_curl->addGet(Test::TEST_URL);
$curls = \Helper\get_multi_curl_property_value($multi_curl, 'curls');
$curls = \Helper\get_multi_curl_property_value($multi_curl, 'queuedCurls');
foreach ($curls as $curl) {
$this->assertEquals([
'Key1: Value1',