You are here

public function Check::__construct in Security Review 8

Initializes the configuration storage and the settings handler.

2 calls to Check::__construct()
ExecutablePhp::__construct in src/Checks/ExecutablePhp.php
Initializes the configuration storage and the settings handler.
TrustedHosts::__construct in src/Checks/TrustedHosts.php
Initializes the configuration storage and the settings handler.
2 methods override Check::__construct()
ExecutablePhp::__construct in src/Checks/ExecutablePhp.php
Initializes the configuration storage and the settings handler.
TrustedHosts::__construct in src/Checks/TrustedHosts.php
Initializes the configuration storage and the settings handler.

File

src/Check.php, line 56

Class

Check
Defines a security check.

Namespace

Drupal\security_review

Code

public function __construct() {
  $this->container = \Drupal::getContainer();
  $this->config = $this
    ->configFactory()
    ->getEditable('security_review.check.' . $this
    ->id());
  $this->settings = new CheckSettings($this, $this->config);
  $this->state = $this->container
    ->get('state');
  $this->statePrefix = 'security_review.check.' . $this
    ->id() . '.';

  // Set check ID in config.
  if ($this->config
    ->get('id') != $this
    ->id()) {
    $this->config
      ->set('id', $this
      ->id());
    $this->config
      ->save();
  }
}