| Conditions | 3 |
| Paths | 1 |
| Total Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.0327 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 8 | public function register(Container $dic) |
|
| 24 | { |
||
| 25 | |||
| 26 | 2 | $dic['Cache.lifetime'] = function($dic) { |
|
|
|
|||
| 27 | 10 | return $this->cache_lifetime; |
|
| 28 | }; |
||
| 29 | |||
| 30 | |||
| 31 | 2 | $dic['Cache.directory'] = function($dic) { |
|
| 32 | 10 | return $this->cache_dir; |
|
| 33 | }; |
||
| 34 | |||
| 35 | |||
| 36 | 4 | $dic['Cache.ItemPool'] = function($dic) { |
|
| 37 | 10 | $cache_dir = $dic['Cache.directory']; |
|
| 38 | |||
| 39 | 10 | if (!$cache_dir) { |
|
| 40 | throw new \Exception("Cache directory not available: " . $cache_dir); |
||
| 41 | } |
||
| 42 | |||
| 43 | 10 | if (!is_writable( $cache_dir)) { |
|
| 44 | throw new \Exception("Cache directory not writeable: $cache_dir"); |
||
| 45 | } |
||
| 46 | |||
| 47 | 10 | return CacheManager::getInstance('files', [ "path" => $cache_dir ]); |
|
| 48 | }; |
||
| 49 | |||
| 50 | |||
| 51 | 10 | } |
|
| 52 | } |
||
| 54 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.