assertRequiredOptions( self::SERVICE_OPTIONS ); $this->serviceOptions = $options; $this->objectFactory = $objectFactory; $this->hookContainer = $hookContainer; $this->linkRenderer = $linkRenderer; $this->contentLanguage = $contentLanguage; $this->commentFormatter = $commentFormatter; $this->userEditTracker = $userEditTracker; } public function newFromEntry( LogEntry $entry ): LogFormatter { $logActionsHandlers = $this->serviceOptions->get( MainConfigNames::LogActionsHandlers ); $fulltype = $entry->getFullType(); $wildcard = $entry->getType() . '/*'; $handler = $logActionsHandlers[$fulltype] ?? $logActionsHandlers[$wildcard] ?? ''; if ( $handler !== '' ) { $formatter = $this->objectFactory->createObject( $handler, [ 'extraArgs' => [ $entry ], 'allowClassName' => true, 'assertClass' => LogFormatter::class, ] ); } else { $formatter = new LegacyLogFormatter( $entry, $this->hookContainer ); } $formatter->setLinkRenderer( $this->linkRenderer ); $formatter->setContentLanguage( $this->contentLanguage ); $formatter->setCommentFormatter( $this->commentFormatter ); $formatter->setUserEditTracker( $this->userEditTracker ); return $formatter; } /** * @param stdClass|array $row * @return LogFormatter * @see DatabaseLogEntry::getSelectQueryData */ public function newFromRow( $row ): LogFormatter { return $this->newFromEntry( DatabaseLogEntry::newFromRow( $row ) ); } } /** @deprecated class alias since 1.44 */ class_alias( LogFormatterFactory::class, 'LogFormatterFactory' );