Set method visibility on languages classes
Change-Id: I5db62d8243ce3abd7c442de10d6143de6dd1aad3
This commit is contained in:
parent
94b12c7ba8
commit
844c6db2b6
10 changed files with 27 additions and 28 deletions
|
|
@ -20,7 +20,6 @@
|
|||
<!-- TODO Still to be done -->
|
||||
<rule ref="Squiz.Scope.MethodScope.Missing">
|
||||
<exclude-pattern>includes/</exclude-pattern>
|
||||
<exclude-pattern>languages/</exclude-pattern>
|
||||
</rule>
|
||||
<!-- See T238572 -->
|
||||
<rule ref="MediaWiki.Commenting.FunctionComment.MissingParamTag">
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ class Language {
|
|||
* @throws MWException
|
||||
* @return Language
|
||||
*/
|
||||
static function factory( $code ) {
|
||||
public static function factory( $code ) {
|
||||
return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $code );
|
||||
}
|
||||
|
||||
|
|
@ -673,7 +673,7 @@ class Language {
|
|||
* @param string $text
|
||||
* @return int|bool An integer if $text is a valid value otherwise false
|
||||
*/
|
||||
function getLocalNsIndex( $text ) {
|
||||
public function getLocalNsIndex( $text ) {
|
||||
$lctext = $this->lc( $text );
|
||||
$ids = $this->getNamespaceIds();
|
||||
return $ids[$lctext] ?? false;
|
||||
|
|
@ -806,7 +806,7 @@ class Language {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getDateFormats() {
|
||||
public function getDateFormats() {
|
||||
return $this->localisationCache->getItem( $this->mCode, 'dateFormats' );
|
||||
}
|
||||
|
||||
|
|
@ -1970,7 +1970,7 @@ class Language {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
static function romanNumeral( $num ) {
|
||||
public static function romanNumeral( $num ) {
|
||||
static $table = [
|
||||
[ '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X' ],
|
||||
[ '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', 'C' ],
|
||||
|
|
@ -2001,7 +2001,7 @@ class Language {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
static function hebrewNumeral( $num ) {
|
||||
public static function hebrewNumeral( $num ) {
|
||||
static $table = [
|
||||
[ '', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י' ],
|
||||
[ '', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק' ],
|
||||
|
|
@ -2166,7 +2166,7 @@ class Language {
|
|||
* if int/string, assumed to be a format.
|
||||
* @return string
|
||||
*/
|
||||
function dateFormat( $usePrefs = true ) {
|
||||
public function dateFormat( $usePrefs = true ) {
|
||||
global $wgUser;
|
||||
|
||||
if ( is_bool( $usePrefs ) ) {
|
||||
|
|
@ -2197,7 +2197,7 @@ class Language {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function getDateFormatString( $type, $pref ) {
|
||||
public function getDateFormatString( $type, $pref ) {
|
||||
$wasDefault = false;
|
||||
if ( $pref == 'default' ) {
|
||||
$wasDefault = true;
|
||||
|
|
@ -2585,7 +2585,7 @@ class Language {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getAllMessages() {
|
||||
public function getAllMessages() {
|
||||
return $this->localisationCache->getItem( $this->mCode, 'messages' );
|
||||
}
|
||||
|
||||
|
|
@ -2699,7 +2699,7 @@ class Language {
|
|||
* @param string $str
|
||||
* @return bool
|
||||
*/
|
||||
function isMultibyte( $str ) {
|
||||
private function isMultibyte( $str ) {
|
||||
return strlen( $str ) !== mb_strlen( $str );
|
||||
}
|
||||
|
||||
|
|
@ -2707,7 +2707,7 @@ class Language {
|
|||
* @param string $str
|
||||
* @return mixed|string
|
||||
*/
|
||||
function ucwords( $str ) {
|
||||
public function ucwords( $str ) {
|
||||
if ( $this->isMultibyte( $str ) ) {
|
||||
$str = $this->lc( $str );
|
||||
|
||||
|
|
@ -2733,7 +2733,7 @@ class Language {
|
|||
* @param string $str
|
||||
* @return mixed
|
||||
*/
|
||||
function ucwordbreaks( $str ) {
|
||||
public function ucwordbreaks( $str ) {
|
||||
if ( $this->isMultibyte( $str ) ) {
|
||||
$str = $this->lc( $str );
|
||||
|
||||
|
|
@ -2786,7 +2786,7 @@ class Language {
|
|||
* @param string $s
|
||||
* @return string
|
||||
*/
|
||||
function checkTitleEncoding( $s ) {
|
||||
public function checkTitleEncoding( $s ) {
|
||||
if ( is_array( $s ) ) {
|
||||
throw new MWException( 'Given array to checkTitleEncoding.' );
|
||||
}
|
||||
|
|
@ -2888,7 +2888,7 @@ class Language {
|
|||
* @param string $s
|
||||
* @return string
|
||||
*/
|
||||
function firstChar( $s ) {
|
||||
public function firstChar( $s ) {
|
||||
$matches = [];
|
||||
preg_match(
|
||||
'/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
|
||||
|
|
@ -3150,7 +3150,7 @@ class Language {
|
|||
* @param string $text The text to be emphasized.
|
||||
* @return string
|
||||
*/
|
||||
function emphasize( $text ) {
|
||||
public function emphasize( $text ) {
|
||||
return "<em>$text</em>";
|
||||
}
|
||||
|
||||
|
|
@ -3239,7 +3239,7 @@ class Language {
|
|||
* string.
|
||||
* @return string
|
||||
*/
|
||||
function commafy( $number ) {
|
||||
public function commafy( $number ) {
|
||||
$digitGroupingPattern = $this->digitGroupingPattern();
|
||||
$minimumGroupingDigits = $this->minimumGroupingDigits();
|
||||
if ( $number === null ) {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class CrhConverter extends LanguageConverter {
|
|||
];
|
||||
}
|
||||
|
||||
function loadExceptions() {
|
||||
private function loadExceptions() {
|
||||
if ( $this->mExceptionsLoaded ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class LanguageJa extends Language {
|
|||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
function emphasize( $text ) {
|
||||
public function emphasize( $text ) {
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class KkConverter extends LanguageConverter {
|
|||
$this->mTables['kk-cn']->merge( $this->mTables['kk-arab'] );
|
||||
}
|
||||
|
||||
function loadRegs() {
|
||||
private function loadRegs() {
|
||||
$this->mCyrl2Latn = [
|
||||
# # Punctuation
|
||||
'/№/u' => 'No.',
|
||||
|
|
@ -296,7 +296,7 @@ class KkConverter extends LanguageConverter {
|
|||
* @param string $toVariant
|
||||
* @return mixed|string
|
||||
*/
|
||||
function regsConverter( $text, $toVariant ) {
|
||||
private function regsConverter( $text, $toVariant ) {
|
||||
if ( $text == '' ) {
|
||||
return $text;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ class LanguageKk_cyrl extends Language {
|
|||
* @param string[] $allVowels
|
||||
* @return array
|
||||
*/
|
||||
function lastLetter( $word, $allVowels ) {
|
||||
private function lastLetter( $word, $allVowels ) {
|
||||
$lastLetter = [];
|
||||
|
||||
// Put the word in a form we can play with since we're using UTF-8
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class LanguageKm extends Language {
|
|||
* @param string $_
|
||||
* @return string
|
||||
*/
|
||||
function commafy( $_ ) {
|
||||
public function commafy( $_ ) {
|
||||
/* NO-op for Khmer. Cannot use
|
||||
* $separatorTransformTable = [ ',' => '' ]
|
||||
* That would break when parsing and doing strstr '' => 'foo';
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class LanguageMy extends Language {
|
|||
* @param string $_
|
||||
* @return string
|
||||
*/
|
||||
function commafy( $_ ) {
|
||||
public function commafy( $_ ) {
|
||||
/* NO-op. Cannot use
|
||||
* $separatorTransformTable = [ ',' => '' ]
|
||||
* That would break when parsing and doing strstr '' => 'foo';
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class LanguageZh extends LanguageZh_hans {
|
|||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
function segmentForDiff( $text ) {
|
||||
public function segmentForDiff( $text ) {
|
||||
return preg_replace( '/[\xc0-\xff][\x80-\xbf]*/', ' $0', $text );
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ class LanguageZh extends LanguageZh_hans {
|
|||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
function unsegmentForDiff( $text ) {
|
||||
public function unsegmentForDiff( $text ) {
|
||||
return preg_replace( '/ ([\xc0-\xff][\x80-\xbf]*)/', '$1', $text );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class CrhExceptions {
|
|||
|
||||
const WB = '\b'; # default word boundary; may be updated in the future
|
||||
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
$this->loadRegs();
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ class CrhExceptions {
|
|||
}
|
||||
}
|
||||
|
||||
function loadExceptions( $lcChars, $ucChars ) {
|
||||
public function loadExceptions( $lcChars, $ucChars ) {
|
||||
# init lc and uc, as needed
|
||||
$this->initLcUc( $lcChars, $ucChars );
|
||||
|
||||
|
|
@ -399,7 +399,7 @@ class CrhExceptions {
|
|||
private $Cyrl2LatnRegexes = [];
|
||||
private $Latn2CyrlRegexes = [];
|
||||
|
||||
function loadRegs() {
|
||||
private function loadRegs() {
|
||||
// Regexes as keys need to be declared in a function.
|
||||
$this->Cyrl2LatnRegexes = [
|
||||
############################
|
||||
|
|
|
|||
Loading…
Reference in a new issue