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