localizer = $localizer; $this->out = $out; $this->pageLang = $pageLang; $this->title = $title; $this->titleData = $titleData; $this->user = $user; } /** * Check if the current page is in the content namespace * * @return bool */ private function shouldAddParenthesis(): bool { $ns = $this->title->getNamespace(); $contentNs = MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces(); return in_array( $ns, $contentNs ); } /** * Return new User object based on username or IP address. * Based on MinervaNeue * * @return UserIdentity|null */ private function buildPageUserObject() { $titleText = $this->title->getText(); $user = $this->user; if ( IPUtils::isIPAddress( $titleText ) ) { return $user->newFromAnyId( null, $titleText, null ); } $userIdentity = MediaWikiServices::getInstance()->getUserIdentityLookup()->getUserIdentityByName( $titleText ); if ( $userIdentity && $userIdentity->isRegistered() ) { return $user->newFromId( $userIdentity->getId() ); } return null; } /** * Return user tagline message * * @return string */ private function buildUserTagline(): string { $localizer = $this->localizer; $user = $this->buildPageUserObject(); if ( $user ) { $tagline = '