* add @method annotations to Cache class

* code beautify
This commit is contained in:
slawkens
2019-05-25 00:20:20 +02:00
parent 933b25194c
commit 7b770e09f7
7 changed files with 44 additions and 28 deletions

View File

@@ -42,8 +42,9 @@ class Cache_PHP
public function get($key)
{
$tmp = '';
if($this->fetch($key, $tmp))
if($this->fetch($key, $tmp)) {
return $tmp;
}
return '';
}
@@ -51,8 +52,9 @@ class Cache_PHP
public function fetch($key, &$var)
{
$file = $this->_name($key);
if(!file_exists($file) || filemtime($file) < time())
if(!file_exists($file) || filemtime($file) < time()) {
return false;
}
@include $file;
$var = isset($var) ? $var : null;
@@ -62,8 +64,9 @@ class Cache_PHP
public function delete($key)
{
$file = $this->_name($key);
if(file_exists($file))
if(file_exists($file)) {
unlink($file);
}
}
public function enabled() {
@@ -73,5 +76,4 @@ class Cache_PHP
private function _name($key) {
return sprintf('%s%s%s', $this->dir, $this->prefix, sha1($key) . '.php');
}
}
?>
}