Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.072 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 18 | public static function getCache(): CacheInterface |
|
32 | { |
||
33 | 18 | if (self::$cache !== null) { |
|
34 | self::dispatchEvent(new ClassNameCacheCachedEvent()); |
||
35 | return self::$cache; |
||
36 | } |
||
37 | |||
38 | 18 | if (self::isEnabled()) { |
|
39 | 3 | self::dispatchEvent(new ClassNamePhpCacheCreatedEvent()); |
|
40 | |||
41 | 3 | self::$cache = new ClassNamePhpCache(Config::getInstance()->getCacheDir()); |
|
42 | } else { |
||
43 | 15 | self::dispatchEvent(new ClassNameInMemoryCacheCreatedEvent()); |
|
44 | 15 | self::$cache = new InMemoryCache(ClassNamePhpCache::class); |
|
45 | } |
||
46 | |||
47 | 18 | return self::$cache; |
|
|
|||
48 | } |
||
55 |