isSpecialPage() ) { [ $spName, $spParam ] = $this->specialPageFactory->resolveAlias( $title->getText() ); if ( $spName ) { $specialPage = $this->specialPageFactory->getPage( $spName ); if ( $specialPage instanceof SpecialMyLanguage ) { // TODO This should pass a language as a parameter, instead of the whole context $specialPage->setContext( RequestContext::getMain() ); $title = $specialPage->findTitleForTransclusion( $spParam ); } } } return $title; } /** * Verify if a given title exists and the given user is allowed to view it * * @param PageIdentity|null $page * @param Authority $performer * @return bool * @phan-assert-true-condition $page */ private function isPageExistingAndViewable( ?PageIdentity $page, Authority $performer ): bool { return $page && $page->exists() && $performer->authorizeRead( 'read', $page ); } }