Total Complexity | 3 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 83.33% |
Changes | 0 |
1 | <?php |
||
20 | class CacheFactory |
||
21 | { |
||
22 | private static $keyEncodedChars = [ |
||
23 | '{' => '%7B', |
||
24 | '}' => '%7D', |
||
25 | '(' => '%28', |
||
26 | ')' => '%29', |
||
27 | '/' => '%2F', |
||
28 | '\\' => '%5C', |
||
29 | '@' => '%40', |
||
30 | ':' => '%3A', |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * @param string $directory |
||
35 | * @param string $namespace |
||
36 | * |
||
37 | * @return AdapterInterface |
||
38 | */ |
||
39 | 20 | public static function createCache($directory, $namespace) |
|
40 | { |
||
41 | 20 | if (PhpFilesAdapter::isSupported()) { |
|
42 | return new PhpFilesAdapter($namespace, 0, $directory); |
||
43 | } |
||
44 | |||
45 | 20 | return new FilesystemAdapter($namespace, 0, $directory); |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @see \Symfony\Component\Cache\CacheItem::validateKey |
||
50 | * |
||
51 | * @param string $key |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | 37 | public static function getValidCacheKey($key) |
|
58 | } |
||
59 | } |
||
60 |