You are here

public function AutomatedCron::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php \Drupal\automated_cron\EventSubscriber\AutomatedCron::__construct()

Constructs a new automated cron runner.

Parameters

\Drupal\Core\CronInterface $cron: The cron service.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\State\StateInterface $state: The state key-value store service.

File

core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php, line 48

Class

AutomatedCron
A subscriber running cron after a response is sent.

Namespace

Drupal\automated_cron\EventSubscriber

Code

public function __construct(CronInterface $cron, ConfigFactoryInterface $config_factory, StateInterface $state) {
  $this->cron = $cron;
  $this->config = $config_factory
    ->get('automated_cron.settings');
  $this->state = $state;
}