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