Filesystem
in package
implements
FilesystemInterface
Uses
PluggableTrait, ConfigAwareTrait
Interfaces, Classes and Traits
Table of Contents
- $adapter : AdapterInterface
- $plugins : array<string|int, mixed>
- __call() : mixed
- Plugins pass-through.
- __construct() : mixed
- Constructor.
- addPlugin() : $this
- Register a plugin.
- assertAbsent() : void
- Assert a file is absent.
- assertPresent() : void
- Assert a file is present.
- copy() : bool
- Copy a file.
- createDir() : bool
- Create a directory.
- delete() : bool
- Delete a file.
- deleteDir() : bool
- Delete a directory.
- emptyDir() :
- forceCopy() :
- forceRename() :
- get() : Handler
- Get a file/directory handler.
- getAdapter() : AdapterInterface
- Get the Adapter.
- 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.
- getWithMetadata() :
- has() : bool
- Check whether a file exists.
- listContents() : array<string|int, mixed>
- List contents of a directory.
- listFiles() :
- listPaths() :
- listWith() :
- 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.
- findPlugin() : PluginInterface
- Find a specific plugin.
- invokePlugin() : mixed
- Invoke a plugin by method name.
Properties
$adapter
protected
AdapterInterface
$adapter
$plugins
protected
array<string|int, mixed>
$plugins
= []
Methods
__call()
Plugins pass-through.
public
__call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
- $method : string
- $arguments : array<string|int, mixed>
Tags
Return values
mixed —__construct()
Constructor.
public
__construct(AdapterInterface $adapter[, Config|array<string|int, mixed> $config = null ]) : mixed
Parameters
- $adapter : AdapterInterface
- $config : Config|array<string|int, mixed> = null
Return values
mixed —addPlugin()
Register a plugin.
public
addPlugin(PluginInterface $plugin) : $this
Parameters
- $plugin : PluginInterface
Tags
Return values
$this —assertAbsent()
Assert a file is absent.
public
assertAbsent(string $path) : void
Parameters
- $path : string
-
path to file
Tags
Return values
void —assertPresent()
Assert a file is present.
public
assertPresent(string $path) : void
Parameters
- $path : string
-
path to file
Tags
Return values
void —copy()
Copy a file.
public
copy(mixed $path, mixed $newpath) : bool
Parameters
- $path : mixed
-
Path to the existing file.
- $newpath : mixed
-
The new path of the file.
Tags
Return values
bool —True on success, false on failure.
createDir()
Create a directory.
public
createDir(mixed $dirname[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $dirname : mixed
-
The name of the new directory.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
delete()
Delete a file.
public
delete(mixed $path) : bool
Parameters
- $path : mixed
Tags
Return values
bool —True on success, false on failure.
deleteDir()
Delete a directory.
public
deleteDir(mixed $dirname) : bool
Parameters
- $dirname : mixed
Tags
Return values
bool —True on success, false on failure.
emptyDir()
public
emptyDir(string $dirname) :
Parameters
- $dirname : string
Return values
—forceCopy()
public
forceCopy(string $path, string $newpath) :
Parameters
- $path : string
- $newpath : string
Return values
—forceRename()
public
forceRename(string $path, string $newpath) :
Parameters
- $path : string
- $newpath : string
Return values
—get()
Get a file/directory handler.
public
get(mixed $path[, Handler $handler = null ]) : Handler
Parameters
- $path : mixed
-
The path to the file.
- $handler : Handler = null
-
An optional existing handler to populate.
Tags
Return values
Handler —Either a file or directory handler.
getAdapter()
Get the Adapter.
public
getAdapter() : AdapterInterface
Return values
AdapterInterface —adapter
getMetadata()
Get a file's metadata.
public
getMetadata(mixed $path) : array<string|int, mixed>|false
Parameters
- $path : mixed
-
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(mixed $path) : string|false
Parameters
- $path : mixed
-
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(mixed $path) : int|false
Parameters
- $path : mixed
-
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(mixed $path) : int|false
Parameters
- $path : mixed
-
The path to the file.
Tags
Return values
int|false —The timestamp or false on failure.
getVisibility()
Get a file's visibility.
public
getVisibility(mixed $path) : string|false
Parameters
- $path : mixed
-
The path to the file.
Tags
Return values
string|false —The visibility (public|private) or false on failure.
getWithMetadata()
public
getWithMetadata(string $path, array<string|int, string> $metadata) :
Parameters
- $path : string
- $metadata : array<string|int, string>
Return values
—has()
Check whether a file exists.
public
has(mixed $path) : bool
Parameters
- $path : mixed
Tags
Return values
bool —listContents()
List contents of a directory.
public
listContents([mixed $directory = '' ][, mixed $recursive = false ]) : array<string|int, mixed>
Parameters
- $directory : mixed = ''
-
The directory to list.
- $recursive : mixed = false
-
Whether to list recursively.
Tags
Return values
array<string|int, mixed> —A list of file metadata.
listFiles()
public
listFiles(string $path, bool $recursive) :
Parameters
- $path : string
- $recursive : bool
Return values
—listPaths()
public
listPaths(string $path, bool $recursive) :
Parameters
- $path : string
- $recursive : bool
Return values
—listWith()
public
listWith(array<string|int, string> $keys, mixed $directory, mixed $recursive) :
Parameters
- $keys : array<string|int, string>
- $directory : mixed
- $recursive : mixed
Return values
—put()
Create a file or update if exists.
public
put(mixed $path, mixed $contents[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : mixed
-
The path to the file.
- $contents : mixed
-
The file contents.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
putStream()
Create a file or update if exists.
public
putStream(mixed $path, mixed $resource[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : mixed
-
The path to the file.
- $resource : mixed
-
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(mixed $path) : string|false
Parameters
- $path : mixed
-
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(mixed $path) : string|false
Parameters
- $path : mixed
-
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(mixed $path) : resource|false
Parameters
- $path : mixed
-
The path to the file.
Tags
Return values
resource|false —The path resource or false on failure.
rename()
Rename a file.
public
rename(mixed $path, mixed $newpath) : bool
Parameters
- $path : mixed
-
Path to the existing file.
- $newpath : mixed
-
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(mixed $path, mixed $visibility) : bool
Parameters
- $path : mixed
-
The path to the file.
- $visibility : mixed
-
One of 'public' or 'private'.
Tags
Return values
bool —True on success, false on failure.
update()
Update an existing file.
public
update(mixed $path, mixed $contents[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : mixed
-
The path of the existing file.
- $contents : mixed
-
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(mixed $path, mixed $resource[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : mixed
-
The path of the existing file.
- $resource : mixed
-
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(mixed $path, mixed $contents[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : mixed
-
The path of the new file.
- $contents : mixed
-
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(mixed $path, mixed $resource[, array<string|int, mixed> $config = [] ]) : bool
Parameters
- $path : mixed
-
The path of the new file.
- $resource : mixed
-
The file handle.
- $config : array<string|int, mixed> = []
-
An optional configuration array.
Tags
Return values
bool —True on success, false on failure.
findPlugin()
Find a specific plugin.
protected
findPlugin(string $method) : PluginInterface
Parameters
- $method : string
Tags
Return values
PluginInterface —invokePlugin()
Invoke a plugin by method name.
protected
invokePlugin(string $method, array<string|int, mixed> $arguments, FilesystemInterface $filesystem) : mixed
Parameters
- $method : string
- $arguments : array<string|int, mixed>
- $filesystem : FilesystemInterface