*/
public function getMatchedLanguage( $userPreferredLanguage ) {
$handler = $this->getHandler();
- if ( $handler && method_exists( $handler, 'getMatchedLanguage' ) ) {
+ if ( $handler ) {
return $handler->getMatchedLanguage(
$userPreferredLanguage,
$handler->getAvailableLanguages( $this )
);
- } else {
- return null;
}
+
+ return null;
}
/**
/**
* Get the HTML text of the description page, if available
*
- * @param bool|Language $lang Optional language to fetch description in
+ * @param Language|null $lang Optional language to fetch description in
* @return string|false
*/
- function getDescriptionText( $lang = false ) {
+ function getDescriptionText( Language $lang = null ) {
global $wgLang;
if ( !$this->repo || !$this->repo->fetchDescription ) {
return false;
}
- $lang = $lang ?: $wgLang;
+ $lang = $lang ?? $wgLang;
$renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $lang->getCode() );
if ( $renderUrl ) {
$lang->getCode(),
md5( $this->getName() )
);
+ $fname = __METHOD__;
return $cache->getWithSetCallback(
$key,
$this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
- function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl ) {
+ function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
wfDebug( "Fetching shared description from $renderUrl\n" );
- $res = Http::get( $renderUrl, [], __METHOD__ );
+ $res = Http::get( $renderUrl, [], $fname );
if ( !$res ) {
$ttl = WANObjectCache::TTL_UNCACHEABLE;
}