Filesystem
in
Interface Filesystem
Tags
Table of Contents
- create() : void
- Creates a new file with the provided path and content.
- delete() : void
- Deletes an existing file.
- getBaseDirectory() : string
- Returns the base directory.
- has() : bool
- Check whether a file exists.
- list() : DirectoryItems
- List content of a directory.
- read() : string|null
- Returns content of a file by the provided path.
- update() : void
- Creates or updates a file with the provided path and content.
Methods
create()
Creates a new file with the provided path and content.
public
create(string $path[, string $content = '' ]) : void
Parameters
- $path : string
- $content : string = ''
Tags
Return values
void —delete()
Deletes an existing file.
public
delete(string $path) : void
Parameters
- $path : string
Tags
Return values
void —getBaseDirectory()
Returns the base directory.
public
getBaseDirectory() : string
Tags
Return values
string —has()
Check whether a file exists.
public
has(string $path) : bool
Parameters
- $path : string
Tags
Return values
bool —list()
List content of a directory.
public
list(string $directory[, bool $recursive = false ]) : DirectoryItems
Parameters
- $directory : string
-
Relative path to directory.
- $recursive : bool = false
Tags
Return values
DirectoryItems —read()
Returns content of a file by the provided path.
public
read(string $path) : string|null
Parameters
- $path : string
-
Relative path to file.
Tags
Return values
string|null —Returns null if file doesn't exist.
update()
Creates or updates a file with the provided path and content.
public
update(string $path, string $content) : void
Parameters
- $path : string
- $content : string