storagePath . '/' . $path; $dir = dirname($fullPath); if (!is_dir($dir)) { mkdir($dir, 0o755, true); } $data = is_string($content) ? $content : ''; file_put_contents($fullPath, $data); return $path; } #[Override] public function delete(string $path): void { $fullPath = $this->storagePath . '/' . $path; if (is_file($fullPath)) { unlink($fullPath); } } #[Override] public function readStream(string $path): mixed { $fullPath = $this->storagePath . '/' . $path; $realPath = realpath($fullPath); $realStoragePath = realpath($this->storagePath); if ($realPath === false || $realStoragePath === false || !str_starts_with($realPath, $realStoragePath)) { throw new RuntimeException(sprintf('Impossible de lire le fichier : %s', $path)); } $stream = fopen($realPath, 'r'); if ($stream === false) { throw new RuntimeException(sprintf('Impossible de lire le fichier : %s', $path)); } return $stream; } }