From dc4d0db09110002a7354565d710d0501d644474c Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Thu, 10 Mar 2022 07:54:13 -0800 Subject: [PATCH] Rename variable --- src/Curl/MultiCurl.php | 16 ++++++++-------- tests/PHPCurlClass/PHPMultiCurlClassTest.php | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Curl/MultiCurl.php b/src/Curl/MultiCurl.php index e3fb322..843a3c1 100755 --- a/src/Curl/MultiCurl.php +++ b/src/Curl/MultiCurl.php @@ -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; } diff --git a/tests/PHPCurlClass/PHPMultiCurlClassTest.php b/tests/PHPCurlClass/PHPMultiCurlClassTest.php index 28cac1f..1cabf8f 100644 --- a/tests/PHPCurlClass/PHPMultiCurlClassTest.php +++ b/tests/PHPCurlClass/PHPMultiCurlClassTest.php @@ -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',