You are here

public function SecretInfo::setSecretInfo in Lockr 4.x

Same name and namespace in other branches
  1. 8.4 src/SecretInfo.php \Drupal\lockr\SecretInfo::setSecretInfo()
  2. 8.3 src/SecretInfo.php \Drupal\lockr\SecretInfo::setSecretInfo()

File

src/SecretInfo.php, line 77

Class

SecretInfo
SecretInfo implements secret info for Lockr secrets.

Namespace

Drupal\lockr

Code

public function setSecretInfo($name, array $info) {
  $secret = $this->secretStorage
    ->load($name);
  if (is_null($secret)) {
    $secret = $this->secretStorage
      ->create([
      'id' => $name,
      'key_id' => $name,
    ]);
  }
  $secret
    ->setInfo($info);
  $secret
    ->save();
}