Skip to content

Commit

Permalink
Rename checkKey() to ensureValidKey()
Browse files Browse the repository at this point in the history
  • Loading branch information
ravage84 committed Sep 5, 2018
1 parent 97316fc commit a200507
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Cache/SimpleCacheEngine.php
Expand Up @@ -43,13 +43,13 @@ public function __construct($innerEngine)
}

/**
* Check key for validity.
* Ensure the validity of the cache key.
*
* @param string $key Key to check.
* @return void
* @throws \Psr\SimpleCache\InvalidArgumentException When key is not valid.
* @throws \Psr\SimpleCache\InvalidArgumentException When the key is not valid.
*/
protected function checkKey($key)
protected function ensureValidKey($key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new InvalidArgumentException('Cache keys must be non-empty strings.');
Expand All @@ -67,7 +67,7 @@ protected function checkKey($key)
*/
public function get($key, $default = null)
{
$this->checkKey($key);
$this->ensureValidKey($key);
$result = $this->innerEngine->read($key);
if ($result === false) {
return $default;
Expand All @@ -90,7 +90,7 @@ public function get($key, $default = null)
*/
public function set($key, $value, $ttl = null)
{
$this->checkKey($key);
$this->ensureValidKey($key);
if ($ttl !== null) {
$restore = $this->innerEngine->getConfig('duration');
$this->innerEngine->setConfig('duration', $ttl);
Expand All @@ -116,7 +116,7 @@ public function set($key, $value, $ttl = null)
*/
public function delete($key)
{
$this->checkKey($key);
$this->ensureValidKey($key);

return $this->innerEngine->delete($key);
}
Expand Down

0 comments on commit a200507

Please sign in to comment.