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