You are here

public function Cron::__construct in Drupal 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::__construct()
  2. 8 core/lib/Drupal/Core/ProxyClass/Cron.php \Drupal\Core\ProxyClass\Cron::__construct()
Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Cron.php \Drupal\Core\Cron::__construct()

Constructs a cron object.

Parameters

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler

\Drupal\Core\Lock\LockBackendInterface $lock: The lock service.

\Drupal\Core\Queue\QueueFactory $queue_factory: The queue service.

\Drupal\Core\State\StateInterface $state: The state service.

\Drupal\Core\Session\AccountSwitcherInterface $account_switcher: The account switching service.

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

\Drupal\Core\Queue\QueueWorkerManagerInterface $queue_manager: The queue plugin manager.

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

File

core/lib/Drupal/Core/Cron.php, line 101

Class

Cron
The Drupal core Cron service.

Namespace

Drupal\Core

Code

public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountSwitcherInterface $account_switcher, LoggerInterface $logger, QueueWorkerManagerInterface $queue_manager, TimeInterface $time = NULL) {
  $this->moduleHandler = $module_handler;
  $this->lock = $lock;
  $this->queueFactory = $queue_factory;
  $this->state = $state;
  $this->accountSwitcher = $account_switcher;
  $this->logger = $logger;
  $this->queueManager = $queue_manager;
  $this->time = $time ?: \Drupal::service('datetime.time');
}