LanguageNameSearch.php: Minor cleanup

Change-Id: If031c59fee64ad6e51dedd3328aec7eca6ed0019
This commit is contained in:
Reedy
2021-11-25 23:33:01 +00:00
committed by jenkins-bot
parent 72c8cdb40b
commit b7e881be0a

View File

@@ -63,13 +63,10 @@ class LanguageNameSearch {
}
$index = self::getIndex( $searchKey );
$bucketsForIndex = [];
if ( isset( LanguageNameSearchData::$buckets[$index] ) ) {
$bucketsForIndex = LanguageNameSearchData::$buckets[$index];
}
$bucketsForIndex = LanguageNameSearchData::$buckets[$index] ?? [];
// types are 'prefix', 'infix' (in this order!)
foreach ( $bucketsForIndex as $bucketType => $bucket ) {
foreach ( $bucketsForIndex as $bucket ) {
foreach ( $bucket as $name => $code ) {
// We can skip checking languages we already have in the list
if ( isset( $results[ $code ] ) ) {
@@ -119,11 +116,11 @@ class LanguageNameSearch {
if ( $codepoint < 4000 ) {
// For latin etc. we need smaller buckets for speed
return $codepoint;
} else {
}
// Try to group names of same script together
return $codepoint - ( $codepoint % 1000 );
}
}
/**
* Get the code point of first letter of string
@@ -143,7 +140,8 @@ class LanguageNameSearch {
$number = $thisValue;
break;
} else {
}
// Codepoints larger than 127 are represented by multi-byte sequences
if ( $values === [] ) {
// 224 is the lowest non-overlong-encoded codepoint.
@@ -165,7 +163,6 @@ class LanguageNameSearch {
break;
}
}
}
return $number;
}