micro-optim: replace for with foreach
This commit is contained in:
parent
4efb9fec50
commit
0f86a33b61
@ -113,13 +113,13 @@ abstract class FormUtil
|
||||
$lowerPluralRev = strtolower($pluralRev);
|
||||
$pluralLength = strlen($lowerPluralRev);
|
||||
|
||||
// The outer loop $i iterates over the entries of the plural table
|
||||
// The outer loop iterates over the entries of the plural table
|
||||
// The inner loop $j iterates over the characters of the plural suffix
|
||||
// in the plural table to compare them with the characters of the actual
|
||||
// given plural suffix
|
||||
for ($i = 0, $numPlurals = count(self::$pluralMap); $i < $numPlurals; ++$i) {
|
||||
$suffix = self::$pluralMap[$i][0];
|
||||
$suffixLength = self::$pluralMap[$i][1];
|
||||
foreach (self::$pluralMap as $map) {
|
||||
$suffix = $map[0];
|
||||
$suffixLength = $map[1];
|
||||
$j = 0;
|
||||
|
||||
// Compare characters in the plural table and of the suffix of the
|
||||
@ -135,19 +135,19 @@ abstract class FormUtil
|
||||
if ($j < $pluralLength) {
|
||||
$nextIsVocal = false !== strpos('aeiou', $lowerPluralRev[$j]);
|
||||
|
||||
if (!self::$pluralMap[$i][2] && $nextIsVocal) {
|
||||
if (!$map[2] && $nextIsVocal) {
|
||||
// suffix may not succeed a vocal but next char is one
|
||||
break;
|
||||
}
|
||||
|
||||
if (!self::$pluralMap[$i][3] && !$nextIsVocal) {
|
||||
if (!$map[3] && !$nextIsVocal) {
|
||||
// suffix may not succeed a consonant but next char is one
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$newBase = substr($plural, 0, $pluralLength - $suffixLength);
|
||||
$newSuffix = self::$pluralMap[$i][4];
|
||||
$newSuffix = $map[4];
|
||||
|
||||
// Check whether the first character in the plural suffix
|
||||
// is uppercased. If yes, uppercase the first character in
|
||||
|
Reference in New Issue
Block a user