function AutomatedCron::__construct

Same name and namespace in other branches
  1. 9 core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php \Drupal\automated_cron\EventSubscriber\AutomatedCron::__construct()
  2. 8.9.x core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php \Drupal\automated_cron\EventSubscriber\AutomatedCron::__construct()
  3. 10 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;
}

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