PHP Class Box\Spout\Common\Helper\FileSystemHelper

Show file Open project: box/spout Class Usage Examples

Protected Properties

Property Type Description
$baseFolderRealPath Real path of the base folder where all the I/O can occur

Public Methods

Method Description
__construct ( string $baseFolderPath )
createFileWithContents ( string $parentFolderPath, string $fileName, string $fileContents ) : string Creates a file with the given name and content in the given folder.
createFolder ( string $parentFolderPath, string $folderName ) : string Creates an empty folder with the given name under the given parent folder.
deleteFile ( string $filePath ) : void Delete the file at the given path
deleteFolderRecursively ( string $folderPath ) : void Delete the folder at the given path as well as all its contents

Protected Methods

Method Description
throwIfOperationNotInBaseFolder ( string $operationFolderPath ) : void All I/O operations must occur inside the base folder, for security reasons.

Method Details

__construct() public method

public __construct ( string $baseFolderPath )
$baseFolderPath string The path of the base folder where all the I/O can occur

createFileWithContents() public method

The parent folder must exist.
public createFileWithContents ( string $parentFolderPath, string $fileName, string $fileContents ) : string
$parentFolderPath string The parent folder path where the file is going to be created
$fileName string The name of the file to create
$fileContents string The contents of the file to create
return string Path of the created file

createFolder() public method

Creates an empty folder with the given name under the given parent folder.
public createFolder ( string $parentFolderPath, string $folderName ) : string
$parentFolderPath string The parent folder path under which the folder is going to be created
$folderName string The name of the folder to create
return string Path of the created folder

deleteFile() public method

Delete the file at the given path
public deleteFile ( string $filePath ) : void
$filePath string Path of the file to delete
return void

deleteFolderRecursively() public method

Delete the folder at the given path as well as all its contents
public deleteFolderRecursively ( string $folderPath ) : void
$folderPath string Path of the folder to delete
return void

throwIfOperationNotInBaseFolder() protected method

This function will throw an exception if the folder where the I/O operation should occur is not inside the base folder.
protected throwIfOperationNotInBaseFolder ( string $operationFolderPath ) : void
$operationFolderPath string The path of the folder where the I/O operation should occur
return void

Property Details

$baseFolderRealPath protected property

Real path of the base folder where all the I/O can occur
protected $baseFolderRealPath