function UserController::__construct

Same name in other branches
  1. 9 core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::__construct()
  2. 8.9.x core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::__construct()
  3. 11.x core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::__construct()

Constructs a UserController object.

Parameters

\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter service.

\Drupal\user\UserStorageInterface $user_storage: The user storage.

\Drupal\user\UserDataInterface $user_data: The user data service.

\Psr\Log\LoggerInterface $logger: A logger instance.

\Drupal\Core\Flood\FloodInterface $flood: The flood service.

\Drupal\Component\Datetime\TimeInterface|null $time: The time service.

File

core/modules/user/src/Controller/UserController.php, line 78

Class

UserController
Controller routines for user routes.

Namespace

Drupal\user\Controller

Code

public function __construct(DateFormatterInterface $date_formatter, UserStorageInterface $user_storage, UserDataInterface $user_data, LoggerInterface $logger, FloodInterface $flood, ?TimeInterface $time = NULL) {
    $this->dateFormatter = $date_formatter;
    $this->userStorage = $user_storage;
    $this->userData = $user_data;
    $this->logger = $logger;
    $this->flood = $flood;
    if ($this->time === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3112298', E_USER_DEPRECATED);
        $this->time = \Drupal::service('datetime.time');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.