You are here

public static function RequestController::create in MongoDB 8.2

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides ControllerBase::create

File

modules/mongodb_watchdog/src/Controller/RequestController.php, line 187

Class

RequestController
The controller for the request events page.

Namespace

Drupal\mongodb_watchdog\Controller

Code

public static function create(ContainerInterface $container) : self {

  /** @var \Psr\Log\LoggerInterface $logger */
  $logger = $container
    ->get('logger.channel.mongodb_watchdog');

  /** @var \Drupal\mongodb_watchdog\Logger $watchdog */
  $watchdog = $container
    ->get(Logger::SERVICE_LOGGER);

  /** @var \Drupal\Core\Config\ImmutableConfig $config */
  $config = $container
    ->get('config.factory')
    ->get('mongodb_watchdog.settings');

  /** @var \Drupal\Core\Datetime\DateFormatterInterface $dateFormatter */
  $dateFormatter = $container
    ->get('date.formatter');

  /** @var \Drupal\Core\Pager\PagerManagerInterface $pagerManager */
  $pagerManager = $container
    ->get('pager.manager');
  $rfcLogLevel = new RfcLogLevel();
  return new static($logger, $watchdog, $config, $dateFormatter, $pagerManager, $rfcLogLevel);
}