| Conditions | 3 |
| Paths | 4 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | public static function pathFor(CacheStoreType|string $storeType, string $identifier): string |
||
| 24 | { |
||
| 25 | $store = $storeType instanceof CacheStoreType ? $storeType->value : $storeType; |
||
| 26 | $root = EnvHelper::getRootPath(); |
||
| 27 | $dir = $root . DIRECTORY_SEPARATOR . 'CacheerPHP' . DIRECTORY_SEPARATOR . 'Flush'; |
||
| 28 | if (!is_dir($dir)) { |
||
| 29 | @mkdir($dir, 0755, true); |
||
|
|
|||
| 30 | } |
||
| 31 | $safeId = preg_replace('/[^a-zA-Z0-9_-]+/', '_', $identifier); |
||
| 32 | return $dir . DIRECTORY_SEPARATOR . $store . '_' . $safeId . '.time'; |
||
| 33 | } |
||
| 35 |
If you suppress an error, we recommend checking for the error condition explicitly: