Documentation

MountManager
in package
implements FilesystemInterface Uses PluggableTrait

Class MountManager.

Proxies methods to Filesystem (@see __call):

Interfaces, Classes and Traits

FilesystemInterface

Table of Contents

$filesystems  : array<string|int, FilesystemInterface>
$plugins  : array<string|int, mixed>
__call()  : mixed
Call forwarder.
__construct()  : mixed
Constructor.
addPlugin()  : $this
Register a plugin.
addPlugin()  : $this
Register a plugin.
assertAbsent()  :
assertPresent()  :
copy()  : bool
Copy a file.
createDir()  : bool
Create a directory.
delete()  : bool
Delete a file.
deleteDir()  : bool
Delete a directory.
filterPrefix()  : array<string|int, mixed>
Retrieve the prefix from an arguments array.
flushCache()  :
get()  : Handler
Get a file/directory handler.
getAdapter()  :
getConfig()  :
getFilesystem()  : FilesystemInterface
Get the filesystem with the corresponding prefix.
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()  : string|false
Get a file's timestamp.
getVisibility()  : string|false
Get a file's visibility.
getWithMetadata()  :
has()  : bool
Check whether a file exists.
invokePluginOnFilesystem()  : mixed
Invoke a plugin on a filesystem mounted on a given prefix.
listContents()  : array<string|int, mixed>
List contents of a directory.
listFiles()  :
listPaths()  :
listWith()  : array<string|int, mixed>
List with plugin adapter.
mountFilesystem()  : $this
Mount filesystems.
mountFilesystems()  : $this
Mount filesystems.
move()  : bool
Move a file.
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.
getPrefixAndPath()  : array<string|int, string>
invokePlugin()  : mixed
Invoke a plugin by method name.

Properties

Methods

__call()

Call forwarder.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Tags
throws
InvalidArgumentException
throws
FilesystemNotFoundException
Return values
mixed

__construct()

Constructor.

public __construct([array<string|int, FilesystemInterface$filesystems = [] ]) : mixed
Parameters
$filesystems : array<string|int, FilesystemInterface> = []

[:prefix => Filesystem,]

Tags
throws
InvalidArgumentException
Return values
mixed

assertAbsent()

public assertAbsent(mixed $path) :
Parameters
$path : mixed
Return values

assertPresent()

public assertPresent(mixed $path) :
Parameters
$path : mixed
Return values

copy()

Copy a file.

public copy(string $from, string $to[, array<string|int, mixed> $config = [] ]) : bool
Parameters
$from : string
$to : string
$config : array<string|int, mixed> = []
Tags
throws
InvalidArgumentException
throws
FilesystemNotFoundException
throws
FileExistsException
Return values
bool

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
throws
FileNotFoundException
Return values
bool

True on success, false on failure.

deleteDir()

Delete a directory.

public deleteDir(string $dirname) : bool
Parameters
$dirname : string
Tags
throws
RootViolationException

Thrown if $dirname is empty.

Return values
bool

True on success, false on failure.

filterPrefix()

Retrieve the prefix from an arguments array.

public filterPrefix(array<string|int, mixed> $arguments) : array<string|int, mixed>
Parameters
$arguments : array<string|int, mixed>
Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>

[:prefix, :arguments]

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
deprecated
Return values
Handler

Either a file or directory handler.

getAdapter()

public getAdapter(mixed $prefix) :
Parameters
$prefix : mixed
Return values

getConfig()

public getConfig(mixed $prefix) :
Parameters
$prefix : mixed
Return values

getMetadata()

Get a file's metadata.

public getMetadata(string $path) : array<string|int, mixed>|false
Parameters
$path : string

The path to the file.

Tags
throws
FileNotFoundException
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
throws
FileNotFoundException
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
throws
FileNotFoundException
Return values
int|false

The file size or false on failure.

getTimestamp()

Get a file's timestamp.

public getTimestamp(string $path) : string|false
Parameters
$path : string

The path to the file.

Tags
throws
FileNotFoundException
Return values
string|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
throws
FileNotFoundException
Return values
string|false

The visibility (public|private) or false on failure.

getWithMetadata()

public getWithMetadata(mixed $path, array<string|int, mixed> $metadata) :
Parameters
$path : mixed
$metadata : array<string|int, mixed>
Return values

has()

Check whether a file exists.

public has(string $path) : bool
Parameters
$path : string
Return values
bool

invokePluginOnFilesystem()

Invoke a plugin on a filesystem mounted on a given prefix.

public invokePluginOnFilesystem(string $method, array<string|int, mixed> $arguments, string $prefix) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
$prefix : string
Tags
throws
FilesystemNotFoundException
Return values
mixed

listContents()

List contents of a directory.

public listContents([string $directory = '' ][, bool $recursive = false ]) : array<string|int, mixed>
Parameters
$directory : string = ''
$recursive : bool = false
Tags
throws
InvalidArgumentException
throws
FilesystemNotFoundException
Return values
array<string|int, mixed>

listFiles()

public listFiles(mixed $directory, mixed $recursive) :
Parameters
$directory : mixed
$recursive : mixed
Return values

listPaths()

public listPaths(mixed $directory, mixed $recursive) :
Parameters
$directory : mixed
$recursive : mixed
Return values

listWith()

List with plugin adapter.

public listWith([array<string|int, mixed> $keys = [] ][, string $directory = '' ][, bool $recursive = false ]) : array<string|int, mixed>
Parameters
$keys : array<string|int, mixed> = []
$directory : string = ''
$recursive : bool = false
Tags
throws
InvalidArgumentException
throws
FilesystemNotFoundException
Return values
array<string|int, mixed>

mountFilesystems()

Mount filesystems.

public mountFilesystems(array<string|int, FilesystemInterface$filesystems) : $this
Parameters
$filesystems : array<string|int, FilesystemInterface>

[:prefix => Filesystem,]

Tags
throws
InvalidArgumentException
Return values
$this

move()

Move a file.

public move(string $from, string $to[, array<string|int, mixed> $config = [] ]) : bool
Parameters
$from : string
$to : string
$config : array<string|int, mixed> = []
Tags
throws
InvalidArgumentException
throws
FilesystemNotFoundException
Return values
bool

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
throws
InvalidArgumentException

Thrown if $resource is not a resource.

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
throws
FileNotFoundException
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
throws
FileNotFoundException
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
throws
FileNotFoundException
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
throws
FileExistsException

Thrown if $newpath exists.

throws
FileNotFoundException

Thrown if $path does not exist.

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
throws
FileNotFoundException
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
throws
FileNotFoundException
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
throws
InvalidArgumentException

If $resource is not a file handle.

throws
FileNotFoundException
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
throws
FileExistsException
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
throws
InvalidArgumentException

If $resource is not a file handle.

throws
FileExistsException
Return values
bool

True on success, false on failure.

getPrefixAndPath()

protected getPrefixAndPath(string $path) : array<string|int, string>
Parameters
$path : string
Tags
throws
InvalidArgumentException
Return values
array<string|int, string>

[:prefix, :path]

Search results