-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid calling function repetitively in loop conditionals #16027
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,7 +331,7 @@ public function getChartUrl($directUrl = true) | |
$thisdataarray = $serie; | ||
if ($this->_encoding == "s") { | ||
// SIMPLE ENCODING | ||
for ($j = 0; $j < sizeof($thisdataarray); $j++) { | ||
for ($j = 0, $jMax = sizeof($thisdataarray); $j < $jMax; $j++) { | ||
$currentvalue = $thisdataarray[$j]; | ||
if (is_numeric($currentvalue)) { | ||
$ylocation = round( | ||
|
@@ -344,7 +344,7 @@ public function getChartUrl($directUrl = true) | |
} | ||
} else { | ||
// EXTENDED ENCODING | ||
for ($j = 0; $j < sizeof($thisdataarray); $j++) { | ||
for ($j = 0, $jMax = sizeof($thisdataarray); $j < $jMax; $j++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also replace sizeof with count? |
||
$currentvalue = $thisdataarray[$j]; | ||
if (is_numeric($currentvalue)) { | ||
if ($yrange) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,7 +200,7 @@ public function testTierPrices($priceScope, $expectedWebsiteId) | |
$this->assertTrue(is_array($tpArray)); | ||
$this->assertEquals(sizeof($tps), sizeof($tpArray)); | ||
|
||
for ($i = 0; $i < sizeof($tps); $i++) { | ||
for ($i = 0, $iMax = sizeof($tps); $i < $iMax; $i++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also replace sizeof with count? |
||
$tpData = $tpArray[$i]; | ||
$this->assertEquals($expectedWebsiteId, $tpData['website_id'], 'Website Id does not match'); | ||
$this->assertEquals($tps[$i]->getValue(), $tpData['price'], 'Price/Value does not match'); | ||
|
@@ -231,7 +231,7 @@ public function testTierPrices($priceScope, $expectedWebsiteId) | |
$this->assertEquals(50, $tpRest->getExtensionAttributes()->getPercentageValue()); | ||
} | ||
|
||
for ($i = 0; $i < sizeof($tps); $i++) { | ||
for ($i = 0, $iMax = sizeof($tps); $i < $iMax; $i++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also replace sizeof with count? |
||
$this->assertEquals( | ||
$tps[$i]->getValue(), | ||
$tpRests[$i]->getValue(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also replace sizeof with count?
It's alias http://php.net/manual/en/function.sizeof.php