Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
OpenSpout\Common\Helper\FileSystemHelper Class Reference
Inheritance diagram for OpenSpout\Common\Helper\FileSystemHelper:
OpenSpout\Common\Helper\FileSystemHelperInterface

Public Member Functions

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

Constructor & Destructor Documentation

◆ __construct()

OpenSpout\Common\Helper\FileSystemHelper::__construct ( string $baseFolderPath)
Parameters
string$baseFolderPathThe path of the base folder where all the I/O can occur

Member Function Documentation

◆ createFileWithContents()

OpenSpout\Common\Helper\FileSystemHelper::createFileWithContents ( string $parentFolderPath,
string $fileName,
string $fileContents )

Creates a file with the given name and content in the given folder.

The parent folder must exist.

Parameters
string$parentFolderPathThe parent folder path where the file is going to be created
string$fileNameThe name of the file to create
string$fileContentsThe contents of the file to create
Return values
stringPath of the created file
Exceptions
OpenSpout\Common\Exception\IOExceptionIf unable to create the file or if the file path is not inside of the base folder

Implements OpenSpout\Common\Helper\FileSystemHelperInterface.

◆ createFolder()

OpenSpout\Common\Helper\FileSystemHelper::createFolder ( string $parentFolderPath,
string $folderName )

Creates an empty folder with the given name under the given parent folder.

Parameters
string$parentFolderPathThe parent folder path under which the folder is going to be created
string$folderNameThe name of the folder to create
Return values
stringPath of the created folder
Exceptions
OpenSpout\Common\Exception\IOExceptionIf unable to create the folder or if the folder path is not inside of the base folder

Implements OpenSpout\Common\Helper\FileSystemHelperInterface.

◆ deleteFile()

OpenSpout\Common\Helper\FileSystemHelper::deleteFile ( string $filePath)

Delete the file at the given path.

Parameters
string$filePathPath of the file to delete
Exceptions
OpenSpout\Common\Exception\IOExceptionIf the file path is not inside of the base folder

Implements OpenSpout\Common\Helper\FileSystemHelperInterface.

◆ deleteFolderRecursively()

OpenSpout\Common\Helper\FileSystemHelper::deleteFolderRecursively ( string $folderPath)

Delete the folder at the given path as well as all its contents.

Parameters
string$folderPathPath of the folder to delete
Exceptions
OpenSpout\Common\Exception\IOExceptionIf the folder path is not inside of the base folder

Implements OpenSpout\Common\Helper\FileSystemHelperInterface.


The documentation for this class was generated from the following file: