public $mConverter;
public $mVariants, $mCode, $mLoaded = false;
- public $mMagicExtensions = [], $mMagicHookDone = false;
+ public $mMagicExtensions = [];
private $mHtmlCode = null, $mParentLanguage = false;
public $dateFormatStrings = [];
return self::$dataCache->getItem( $this->mCode, 'magicWords' );
}
- /**
- * Run the LanguageGetMagic hook once.
- */
- protected function doMagicHook() {
- if ( $this->mMagicHookDone ) {
- return;
- }
- $this->mMagicHookDone = true;
- Hooks::run( 'LanguageGetMagic', [ &$this->mMagicExtensions, $this->getCode() ], '1.16' );
- }
-
/**
* Fill a MagicWord object with data from here
*
* @param MagicWord $mw
*/
function getMagic( $mw ) {
- // Saves a function call
- if ( !$this->mMagicHookDone ) {
- $this->doMagicHook();
- }
-
- if ( isset( $this->mMagicExtensions[$mw->mId] ) ) {
- $rawEntry = $this->mMagicExtensions[$mw->mId];
- } else {
- $rawEntry = self::$dataCache->getSubitem(
- $this->mCode, 'magicWords', $mw->mId );
- }
+ $rawEntry = $this->mMagicExtensions[$mw->mId] ??
+ self::$dataCache->getSubitem( $this->mCode, 'magicWords', $mw->mId );
if ( !is_array( $rawEntry ) ) {
wfWarn( "\"$rawEntry\" is not a valid magic word for \"$mw->mId\"" );
// Initialise array
$this->mExtendedSpecialPageAliases =
self::$dataCache->getItem( $this->mCode, 'specialPageAliases' );
- Hooks::run( 'LanguageGetSpecialPageAliases',
- [ &$this->mExtendedSpecialPageAliases, $this->getCode() ], '1.16' );
}
return $this->mExtendedSpecialPageAliases;
public function getPluralRuleType( $number ) {
$index = $this->getPluralRuleIndexNumber( $number );
$pluralRuleTypes = $this->getPluralRuleTypes();
- if ( isset( $pluralRuleTypes[$index] ) ) {
- return $pluralRuleTypes[$index];
- } else {
- return 'other';
- }
+ return $pluralRuleTypes[$index] ?? 'other';
}
}