(array $doc)
| 82 | } |
| 83 | |
| 84 | private static function write(array $doc): bool |
| 85 | { |
| 86 | $path = self::filePath(); |
| 87 | $dir = dirname($path); |
| 88 | if (!is_dir($dir)) { |
| 89 | @mkdir($dir, 0775, true); |
| 90 | } |
| 91 | |
| 92 | $json = json_encode($doc, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
| 93 | if (!is_string($json)) { |
| 94 | return false; |
| 95 | } |
| 96 | |
| 97 | $ok = @file_put_contents($path, $json, LOCK_EX) !== false; |
| 98 | if ($ok) { |
| 99 | @chmod($path, 0664); |
| 100 | self::$cache = $doc; |
| 101 | self::$cacheMtime = is_file($path) ? (int)@filemtime($path) : 0; |
| 102 | self::$cachePath = $path; |
| 103 | } |
| 104 | return $ok; |
| 105 | } |
| 106 | |
| 107 | public static function isEncrypted(string $folder): bool |
| 108 | { |
no test coverage detected