1 <?php 2 3 declare(strict_types=1); 4 5 namespace OpenSpout\Common\Helper; 6 7 /** 8 * @internal 9 */ 10 interface FileSystemHelperInterface 11 { 12 /** 13 * Creates an empty folder with the given name under the given parent folder. 14 * 15 * @param string $parentFolderPath The parent folder path under which the folder is going to be created 16 * @param string $folderName The name of the folder to create 17 * 18 * @return string Path of the created folder 19 * 20 * @throws \OpenSpout\Common\Exception\IOException If unable to create the folder or if the folder path is not inside of the base folder 21 */ 22 public function createFolder(string $parentFolderPath, string $folderName): string; 23 24 /** 25 * Creates a file with the given name and content in the given folder. 26 * The parent folder must exist. 27 * 28 * @param string $parentFolderPath The parent folder path where the file is going to be created 29 * @param string $fileName The name of the file to create 30 * @param string $fileContents The contents of the file to create 31 * 32 * @return string Path of the created file 33 * 34 * @throws \OpenSpout\Common\Exception\IOException If unable to create the file or if the file path is not inside of the base folder 35 */ 36 public function createFileWithContents(string $parentFolderPath, string $fileName, string $fileContents): string; 37 38 /** 39 * Delete the file at the given path. 40 * 41 * @param string $filePath Path of the file to delete 42 * 43 * @throws \OpenSpout\Common\Exception\IOException If the file path is not inside of the base folder 44 */ 45 public function deleteFile(string $filePath): void; 46 47 /** 48 * Delete the folder at the given path as well as all its contents. 49 * 50 * @param string $folderPath Path of the folder to delete 51 * 52 * @throws \OpenSpout\Common\Exception\IOException If the folder path is not inside of the base folder 53 */ 54 public function deleteFolderRecursively(string $folderPath): void; 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body