| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 77.78% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait HasCacheTrait |
||
| 10 | { |
||
| 11 | protected $_cache; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param $key |
||
| 15 | * @param null $default |
||
|
|
|||
| 16 | * @return mixed |
||
| 17 | */ |
||
| 18 | 11 | public function getCache($key, $default = null) |
|
| 19 | { |
||
| 20 | 11 | if (!isset($this->_cache[$key])) { |
|
| 21 | 11 | return $default; |
|
| 22 | } |
||
| 23 | 6 | return $this->_cache[$key]; |
|
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $key |
||
| 28 | * @param $value |
||
| 29 | */ |
||
| 30 | 11 | public function setCache($key, $value) |
|
| 31 | { |
||
| 32 | 11 | $this->_cache[$key] = $value; |
|
| 33 | 11 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @param $key |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | public function isCache($key) |
||
| 42 | } |
||
| 43 | } |
||
| 44 |