| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 34 | public function onPluginsLoaded() |
|
| 32 | { |
||
| 33 | 34 | $storage = $this->settings['storage']; |
|
| 34 | 34 | $config = $this->settings; |
|
| 35 | |||
| 36 | 34 | if (!empty($config['phpFastCacheConfig'])) { |
|
| 37 | 1 | $cacheConfig = $config['phpFastCacheConfig']; |
|
| 38 | } else { |
||
| 39 | // Remove options unknown to Phpfastcache triggering errors |
||
| 40 | 33 | unset($config['active'], $config['storage']); |
|
| 41 | 33 | if ($storage == 'files') { |
|
| 42 | 1 | $cacheConfig = new \Phpfastcache\Drivers\Files\Config($config); |
|
| 43 | } else { |
||
| 44 | 32 | $cacheConfig = new \Phpfastcache\Config\ConfigurationOption($config); |
|
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | 34 | $psr16Cache = new \Phpfastcache\Helper\Psr16Adapter($storage, $cacheConfig); |
|
| 49 | 34 | $phileCache = new PhileToPsr16CacheAdapter($psr16Cache); |
|
| 50 | 34 | ServiceLocator::registerService('Phile_Cache', $phileCache); |
|
| 51 | } |
||
| 53 |