$filesystems
$filesystems : array
An associative array that stores the registered filesystems.
Class FilesystemMap.
The FilesystemMap
class implements the FilesystemMapInterface
and serves as a registry for associating filesystem instances with
their respective names. It provides methods to register, retrieve,
check the existence of, and remove filesystems by name,
enabling a structured and manageable way to handle multiple
filesystem implementations.
This class ensures that the names of the filesystems follow a
specific format, preventing the use of invalid characters.
It is particularly useful in scenarios where multiple filesystems are utilized, such as local storage, cloud storage, or remote filesystems, allowing easy access and management of these resources through a common interface.
set(string $name, \Omega\Filesystem\FilesystemInterface $filesystem) : void
Registers the given filesystem for the specified name.
This method associates a filesystem instance with a name in the registry. The name must contain only valid characters (letters, numbers, hyphens, and underscores) to ensure proper identification of the filesystem.
string | $name | The name to associate with the filesystem. |
\Omega\Filesystem\FilesystemInterface | $filesystem | The filesystem instance to register. |
When the specified name contains forbidden characters.
get(string $name) : \Omega\Filesystem\FilesystemInterface
Returns the filesystem registered for the specified name.
Retrieves the filesystem registered under the specified name.
string | $name | The name of the filesystem to retrieve. |
When there is no filesystem defined for the specified name.
The filesystem instance associated with the given name.
remove(string $name) : void
Removes the filesystem registered for the specified name.
This method allows for the removal of a filesystem from the registry by its name. It throws an exception if the filesystem is not found in the registry.
string | $name | The name of the filesystem to remove. |
When the specified filesystem is not defined.