Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | 25 | public static function getCacheInstance(): CacheInterface |
|
29 | { |
||
30 | 25 | if (self::$cache !== null) { |
|
31 | 15 | self::dispatchEvent(new CustomServicesCacheCachedEvent()); |
|
32 | |||
33 | 15 | return self::$cache; |
|
34 | } |
||
35 | |||
36 | 13 | if (self::isProjectCacheEnabled()) { |
|
37 | 4 | self::dispatchEvent(new CustomServicesPhpCacheCreatedEvent()); |
|
38 | 4 | self::$cache = new CustomServicesPhpCache(Config::getInstance()->getCacheDir()); |
|
39 | } else { |
||
40 | 9 | self::dispatchEvent(new CustomServicesInMemoryCacheCreatedEvent()); |
|
41 | 9 | self::$cache = new InMemoryCache(CustomServicesPhpCache::class); |
|
42 | } |
||
43 | |||
44 | 13 | return self::$cache; |
|
|
|||
45 | } |
||
52 |