FileUtil
in package
File utility class for dealing with files.
Table of Contents
- appendStringToFile() : mixed
- Appends the specified string to the specified file.
- fileToString() : string
- Reads the contents of the specified file and returns it as a string.
- getErrorHandler() : ErrorHandlerInterface
- Gets the error handler for the class.
- setErrorHandler() : mixed
- Sets the error handler used for methods in this class.
- writeStringToFile() : mixed
- Writes the specified string to the specified file.
Methods
appendStringToFile()
Appends the specified string to the specified file.
public
static appendStringToFile(string $string, string $filename) : mixed
Parameters
- $string : string
-
the string to append.
- $filename : string
-
the name of the file that is appended.
Tags
Return values
mixed —false on failure, and the number of bytes appended on success.
fileToString()
Reads the contents of the specified file and returns it as a string.
public
static fileToString(string $filename) : string
Parameters
- $filename : string
-
the name of the file that is to be read.
Tags
Return values
string —the contents of the specified file.
getErrorHandler()
Gets the error handler for the class.
public
static getErrorHandler() : ErrorHandlerInterface
Return values
ErrorHandlerInterface —the error handler for the class.
setErrorHandler()
Sets the error handler used for methods in this class.
public
static setErrorHandler(ErrorHandlerInterface $errorHandler) : mixed
Parameters
- $errorHandler : ErrorHandlerInterface
Return values
mixed —writeStringToFile()
Writes the specified string to the specified file.
public
static writeStringToFile(string $string, string $filename[, bool $append = false ]) : mixed
Parameters
- $string : string
-
the string to write to the file.
- $filename : string
-
the name of the file to write the string.
- $append : bool = false
-
if true, the file is appended if it already exists. If false, the file is created if it doesn't exist, and overwritten if it does.
Tags
Return values
mixed —false on failure, and the number of bytes written on success.