| Total Complexity | 8 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class ApcuDriver implements DriverInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * ApcuDriver constructor. |
||
| 20 | * |
||
| 21 | * @codeCoverageIgnore |
||
| 22 | * |
||
| 23 | * @throws ApcuDriverCheckException |
||
| 24 | */ |
||
| 25 | public function __construct() |
||
| 26 | { |
||
| 27 | if (!$this->check()) { |
||
| 28 | throw new ApcuDriverCheckException('Apcu extension is not loaded.'); |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->connect(); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @codeCoverageIgnore |
||
| 36 | * |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | public function check() |
||
| 40 | { |
||
| 41 | if (extension_loaded('apcu') && ini_get('apc.enabled')) { |
||
| 42 | return true; |
||
| 43 | } |
||
| 44 | |||
| 45 | return false; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | public function clear() |
||
| 52 | { |
||
| 53 | return apcu_clear_cache(); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | public function connect() |
||
| 60 | { |
||
| 61 | return true; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return mixed |
||
| 66 | */ |
||
| 67 | public function getInstance() |
||
| 70 | } |
||
| 71 | } |
||
| 72 |