public function KeyClient::get in Lockr 7
Same name and namespace in other branches
- 7.2 vendor/lockr/lockr-client/src/KeyClient.php \Lockr\KeyClient::get()
Gets a key from Lockr.
Parameters
string $name The key name.:
Return value
string The key.
File
- src/
Lockr/ KeyClient.php, line 51
Class
Namespace
LockrCode
public function get($name) {
list($status, $body) = $this->client
->get($this
->uri($name));
$body = json_decode($body, true);
if (json_last_error() !== JSON_ERROR_NONE || $status >= 500) {
throw new ServerException();
}
if ($status >= 400) {
throw new ClientException();
}
if (null !== $this->encoded) {
return $this
->decrypt($body['key_value'], $this->encoded);
}
return $body['key_value'];
}