| Conditions | 3 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public static function getHandler() |
||
| 39 | { |
||
| 40 | if (!config()->has('cache')) { |
||
| 41 | config()->import(new Setup('Config', 'cache')); |
||
| 42 | } |
||
| 43 | |||
| 44 | $cacheDriver = config()->get('cache.current'); |
||
| 45 | |||
| 46 | if (!in_array($cacheDriver, self::DRIVERS)) { |
||
| 47 | throw new \Exception(); |
||
| 48 | } |
||
| 49 | |||
| 50 | $cacheAdapterClass = __NAMESPACE__ . '\\Adapters\\' . ucfirst($cacheDriver) . 'Cache'; |
||
|
|
|||
| 51 | |||
| 52 | $cacheAdapter = new $cacheAdapterClass(config()->get('cache.' . $cacheDriver . '.params')); |
||
| 53 | |||
| 54 | return new Cache($cacheAdapter); |
||
| 55 | } |
||
| 58 |