KeyProvider.php in Akamai 8.3
File
src/KeyProvider.php
View source
<?php
namespace Drupal\akamai;
class KeyProvider implements KeyProviderInterface {
protected $keyRepository;
public function __construct($key_repository) {
$this->keyRepository = $key_repository;
}
public function hasKeyRepository() {
return isset($this->keyRepository);
}
public function getKey($key) {
if (!$this
->hasKeyRepository()) {
throw new \Exception('Missing key.repository service. Ensure key module is enabled.');
}
$key_entity = $this->keyRepository
->getKey($key);
if (isset($key_entity)) {
return $key_entity
->getKeyValue();
}
return NULL;
}
public function getKeys() {
if (!$this
->hasKeyRepository()) {
throw new \Exception('Missing key.repository service. Ensure key module is enabled.');
}
return $this->keyRepository
->getKeys();
}
}
Classes
Name |
Description |
KeyProvider |
Wrapper around the optional key.provider service. |