public function LockrKeyProvider::getKeyValue in Lockr 8.3
Same name and namespace in other branches
- 8.4 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
- 8.2 src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
- 4.x src/Plugin/KeyProvider/LockrKeyProvider.php \Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider::getKeyValue()
Returns the value of a key.
Parameters
\Drupal\key\KeyInterface $key: The key whose value will be retrieved.
Return value
string The key value.
Overrides KeyProviderInterface::getKeyValue
File
- src/
Plugin/ KeyProvider/ LockrKeyProvider.php, line 160 - Contains Drupal\lockr\Plugin\KeyProvider\LockrKeyProvider.
Class
- LockrKeyProvider
- Adds a key provider that allows a key to be stored in Lockr.
Namespace
Drupal\lockr\Plugin\KeyProviderCode
public function getKeyValue(KeyInterface $key) {
try {
$key_value = $this->lockr
->getSecretValue($key
->id());
} catch (\Exception $e) {
if ($e
->getCode() === 404) {
return $this
->generateKey($key);
}
$this
->logException($e);
return NULL;
}
if (is_null($key_value)) {
return $this
->generateKey($key);
}
return $key_value;
}