FilesystemInterface
in
Table of Contents
- addPlugin() : $this
- Register a plugin.
- copy() : bool
- Copy a file.
- createDir() : bool
- Create a directory.
- delete() : bool
- Delete a file.
- deleteDir() : bool
- Delete a directory.
- get() : Handler
- Get a file/directory handler.
- getMetadata() : array<string|int, mixed>|false
- Get a file's metadata.
- getMimetype() : string|false
- Get a file's mime-type.
- getSize() : int|false
- Get a file's size.
- getTimestamp() : int|false
- Get a file's timestamp.
- getVisibility() : string|false
- Get a file's visibility.
- has() : bool
- Check whether a file exists.
- listContents() : array<string|int, mixed>
- List contents of a directory.
- put() : bool
- Create a file or update if exists.
- putStream() : bool
- Create a file or update if exists.
- read() : string|false
- Read a file.
- readAndDelete() : string|false
- Read and delete a file.
- readStream() : resource|false
- Retrieves a read-stream for a path.
- rename() : bool
- Rename a file.
- setVisibility() : bool
- Set the visibility for a file.
- update() : bool
- Update an existing file.
- updateStream() : bool
- Update an existing file using a stream.
- write() : bool
- Write a new file.
- writeStream() : bool
- Write a new file using a stream.
Methods
addPlugin()
Register a plugin.
public
addPlugin(PluginInterface $plugin) : $this
Parameters
- $plugin : PluginInterface
-
The plugin to register.
Return values
$this —copy()
Copy a file.
public
copy(string $path, string $newpath) : bool
Parameters
- $path : string
-
Path to the existing file.
- $newpath : string
-
The new path of the file.
Tags
Return values
bool —True on success, false on failure.
createDir()
Create a directory.
public
createDir(string $dirname[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $dirname : string
-
The name of the new directory.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Return values
bool —True on success, false on failure.
delete()
Delete a file.
public
delete(string $path) : bool
Parameters
- $path : string
Tags
Return values
bool —True on success, false on failure.
deleteDir()
Delete a directory.
public
deleteDir(string $dirname) : bool
Parameters
- $dirname : string
Tags
Return values
bool —True on success, false on failure.
get()
Get a file/directory handler.
public
get(string $path[, Handler $handler = null ]) : Handler
Parameters
- $path : string
-
The path to the file.
- $handler : Handler = null
-
An optional existing handler to populate.
Tags
Return values
Handler —Either a file or directory handler.
getMetadata()
Get a file's metadata.
public
getMetadata(string $path) : array<string|int, mixed>|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
array<string|int, mixed>|false —The file metadata or false on failure.
getMimetype()
Get a file's mime-type.
public
getMimetype(string $path) : string|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
string|false —The file mime-type or false on failure.
getSize()
Get a file's size.
public
getSize(string $path) : int|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
int|false —The file size or false on failure.
getTimestamp()
Get a file's timestamp.
public
getTimestamp(string $path) : int|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
int|false —The timestamp or false on failure.
getVisibility()
Get a file's visibility.
public
getVisibility(string $path) : string|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
string|false —The visibility (public|private) or false on failure.
has()
Check whether a file exists.
public
has(string $path) : bool
Parameters
- $path : string
Return values
bool —listContents()
List contents of a directory.
public
listContents([string $directory = '' ][, bool $recursive = false ]) : array<string|int, mixed>
Parameters
- $directory : string = ''
-
The directory to list.
- $recursive : bool = false
-
Whether to list recursively.
Return values
array<string|int, mixed> —A list of file metadata.
put()
Create a file or update if exists.
public
put(string $path, string $contents[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : string
-
The path to the file.
- $contents : string
-
The file contents.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Return values
bool —True on success, false on failure.
putStream()
Create a file or update if exists.
public
putStream(string $path, resource $resource[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : string
-
The path to the file.
- $resource : resource
-
The file handle.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
read()
Read a file.
public
read(string $path) : string|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
string|false —The file contents or false on failure.
readAndDelete()
Read and delete a file.
public
readAndDelete(string $path) : string|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
string|false —The file contents, or false on failure.
readStream()
Retrieves a read-stream for a path.
public
readStream(string $path) : resource|false
Parameters
- $path : string
-
The path to the file.
Tags
Return values
resource|false —The path resource or false on failure.
rename()
Rename a file.
public
rename(string $path, string $newpath) : bool
Parameters
- $path : string
-
Path to the existing file.
- $newpath : string
-
The new path of the file.
Tags
Return values
bool —True on success, false on failure.
setVisibility()
Set the visibility for a file.
public
setVisibility(string $path, string $visibility) : bool
Parameters
- $path : string
-
The path to the file.
- $visibility : string
-
One of 'public' or 'private'.
Tags
Return values
bool —True on success, false on failure.
update()
Update an existing file.
public
update(string $path, string $contents[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : string
-
The path of the existing file.
- $contents : string
-
The file contents.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
updateStream()
Update an existing file using a stream.
public
updateStream(string $path, resource $resource[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : string
-
The path of the existing file.
- $resource : resource
-
The file handle.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
write()
Write a new file.
public
write(string $path, string $contents[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : string
-
The path of the new file.
- $contents : string
-
The file contents.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
writeStream()
Write a new file using a stream.
public
writeStream(string $path, resource $resource[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : string
-
The path of the new file.
- $resource : resource
-
The file handle.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.