5use InvalidArgumentException;
97 if ( ! is_string($prefix)) {
98 throw new InvalidArgumentException(__METHOD__ .
' expects argument #1 to be a string.');
135 if (empty($arguments)) {
136 throw new InvalidArgumentException(
'At least one argument needed');
139 $path = array_shift($arguments);
141 if ( ! is_string(
$path)) {
142 throw new InvalidArgumentException(
'First argument should be a string');
146 array_unshift($arguments,
$path);
148 return [$prefix, $arguments];
164 $result = $filesystem->listContents($directory, $recursive);
167 $file[
'filesystem'] = $prefix;
184 public function __call($method, $arguments)
186 list($prefix, $arguments) = $this->
filterPrefix($arguments);
207 if ($buffer ===
false) {
215 if (is_resource($buffer)) {
234 public function listWith(array
$keys = [], $directory =
'', $recursive =
false)
237 $arguments = [
$keys, $directory, $recursive];
259 return $this->
delete(
$from);
281 return $this->
invokePlugin($method, $arguments, $filesystem);
286 $callback = [$filesystem, $method];
288 return call_user_func_array($callback, $arguments);
300 if (strpos(
$path,
'://') < 1) {
301 throw new InvalidArgumentException(
'No prefix detected in path: ' .
$path);
304 return explode(
'://',
$path, 2);
An exception for terminatinating execution or to throw for unit testing.
Thrown when the MountManager cannot find a filesystem.
move($from, $to, array $config=[])
Move a file.
copy($from, $to, array $config=[])
mountFilesystem($prefix, FilesystemInterface $filesystem)
Mount filesystems.
__call($method, $arguments)
Call forwarder.
mountFilesystems(array $filesystems)
Mount filesystems.
listContents($directory='', $recursive=false)
getFilesystem($prefix)
Get the filesystem with the corresponding prefix.
__construct(array $filesystems=[])
Constructor.
invokePluginOnFilesystem($method, $arguments, $prefix)
Invoke a plugin on a filesystem mounted on a given prefix.
filterPrefix(array $arguments)
Retrieve the prefix from an arguments array.
listWith(array $keys=[], $directory='', $recursive=false)
List with plugin adapter.
static filesystems()
Returns the loaded filesystems.
invokePlugin($method, array $arguments, FilesystemInterface $filesystem)
Invoke a plugin by method name.