Remove phpcs exclude rules and update PHP code

Change-Id: Ie37deda368a4d163cf324988721033829ae8af77
This commit is contained in:
Fomafix
2022-11-12 19:05:41 +00:00
committed by jenkins-bot
parent 7e8976ecf0
commit e44e4c4c0c
9 changed files with 95 additions and 5 deletions

View File

@@ -144,6 +144,9 @@ class LanguageNameIndexer extends Maintenance {
$this->generateFile( $buckets );
}
/**
* @return array
*/
private function getLanguageData() {
$file = __DIR__ . '/../lib/jquery.uls/src/jquery.uls.data.js';
$contents = file_get_contents( $file );
@@ -158,6 +161,9 @@ class LanguageNameIndexer extends Maintenance {
return $data;
}
/**
* @param array $buckets
*/
private function generateFile( array $buckets ) {
$template = <<<'PHP'
<?php

View File

@@ -105,11 +105,21 @@ class LanguageNameSearch {
return $results;
}
/**
* @param string $name
* @param string $searchKey
* @param int $typos
* @return bool
*/
public static function matchNames( $name, $searchKey, $typos ) {
return strrpos( $name, $searchKey, -strlen( $name ) ) !== false
|| ( $typos > 0 && self::levenshteinDistance( $name, $searchKey ) <= $typos );
}
/**
* @param string $name
* @return int
*/
public static function getIndex( $name ) {
$codepoint = self::getCodepoint( $name );