function PermissionsHashGenerator::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Session/PermissionsHashGenerator.php \Drupal\Core\Session\PermissionsHashGenerator::__construct()
  2. 8.9.x core/lib/Drupal/Core/Session/PermissionsHashGenerator.php \Drupal\Core\Session\PermissionsHashGenerator::__construct()
  3. 11.x core/lib/Drupal/Core/Session/PermissionsHashGenerator.php \Drupal\Core\Session\PermissionsHashGenerator::__construct()

Constructs a PermissionsHashGenerator object.

Parameters

\Drupal\Core\PrivateKey $private_key: The private key service.

\Drupal\Core\Cache\CacheBackendInterface $static: The cache backend interface to use for the static cache.

\Drupal\Core\Session\AccessPolicyProcessorInterface|\Drupal\Core\Cache\CacheBackendInterface $processor: The access policy processor.

File

core/lib/Drupal/Core/Session/PermissionsHashGenerator.php, line 47

Class

PermissionsHashGenerator
Generates and caches the permissions hash for a user.

Namespace

Drupal\Core\Session

Code

public function __construct(PrivateKey $private_key, CacheBackendInterface $static, AccessPolicyProcessorInterface|CacheBackendInterface $processor) {
    $this->privateKey = $private_key;
    if ($processor instanceof CacheBackendInterface) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $processor argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3402110', E_USER_DEPRECATED);
        $this->static = $processor;
        $this->processor = \Drupal::service('access_policy_processor');
        return;
    }
    $this->static = $static;
    $this->processor = $processor;
}

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