You are here

public function PrivateKey::get in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/PrivateKey.php \Drupal\Core\PrivateKey::get()
  2. 9 core/lib/Drupal/Core/PrivateKey.php \Drupal\Core\PrivateKey::get()

Gets the private key.

Return value

string The private key.

File

core/lib/Drupal/Core/PrivateKey.php, line 36

Class

PrivateKey
Manages the Drupal private key.

Namespace

Drupal\Core

Code

public function get() {
  if (!($key = $this->state
    ->get('system.private_key'))) {
    $key = $this
      ->create();
    $this
      ->set($key);
  }
  return $key;
}