];
public $mMainLanguageCode;
+
+ /**
+ * @var string[]
+ */
public $mVariants;
public $mVariantFallbacks;
public $mVariantNames;
const CACHE_VERSION_KEY = 'VERSION 7';
/**
- * Constructor
- *
* @param Language $langobj
* @param string $maincode The main language code of this language
- * @param array $variants The supported variants of this language
+ * @param string[] $variants The supported variants of this language
* @param array $variantfallbacks The fallback language of each variant
* @param array $flags Defining the custom strings that maps to the flags
* @param array $manualLevel Limit for supported variants
* Get all valid variants.
* Call this instead of using $this->mVariants directly.
*
- * @return array Contains all valid variants
+ * @return string[] Contains all valid variants
*/
public function getVariants() {
return $this->mVariants;
$literalBlob = '';
// Guard against delimiter nulls in the input
+ // (should never happen: see T159174)
$text = str_replace( "\000", '', $text );
$markupMatches = null;
* @throws MWException
*/
function loadDefaultTables() {
- $name = get_class( $this );
-
- throw new MWException( "Must implement loadDefaultTables() method in class $name" );
+ $class = static::class;
+ throw new MWException( "Must implement loadDefaultTables() method in class $class" );
}
/**
$this->mTables = false;
$cache = ObjectCache::getInstance( $wgLanguageConverterCacheType );
if ( $fromCache ) {
- wfProfileIn( __METHOD__ . '-cache' );
$this->mTables = $cache->get( $this->mCacheKey );
- wfProfileOut( __METHOD__ . '-cache' );
}
if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
- wfProfileIn( __METHOD__ . '-recache' );
// not in cache, or we need a fresh reload.
// We will first load the default tables
// then update them using things in MediaWiki:Conversiontable/*
$this->mTables[self::CACHE_VERSION_KEY] = true;
$cache->set( $this->mCacheKey, $this->mTables, 43200 );
- wfProfileOut( __METHOD__ . '-recache' );
}
}