66 if ($this->flySystemFS->has(
$path)) {
67 $meta = $this->flySystemFS->getMetadata(
$path);
69 if (!(is_array($meta) && array_key_exists(self::$metaTypeKey, $meta))) {
70 throw new IOException(
"Could not evaluate path type: \"$path\"");
101 $metadataCollection = [];
104 if (!(array_key_exists(self::$metaTypeKey, $content) && array_key_exists(self::$metaPathKey, $content))) {
105 throw new IOException(
"Invalid metadata received for path \"$path\"");
111 return $metadataCollection;
136 $config = [
'visibility' => $visibility];
137 $successful = $this->flySystemFS->createDir(
$path,
$config);
140 throw new IOException(
"Could not create directory \"$path\"");
171 foreach ($contentList as $content) {
174 if ($content->isFile()) {
177 $position = strpos($content->getPath(),
$source);
178 if ($position !==
false) {
179 $destinationFilePath = substr_replace($content->getPath(),
$destination, $position, strlen(
$source));
180 $this->fileAccess->copy($content->getPath(), $destinationFilePath);
200 if (count($destinationContent) !== 0) {
201 throw new IOException(
"Destination \"$path\" is not empty can not copy files.");
240 if ($this->flySystemFS->deleteDir(
$path) ===
false) {
241 throw new IOException(
"Could not delete directory \"$path\".");
244 throw new IOException(
'The filesystem root must not be deleted.', 0, $ex);
264 $metadataArray[self::$metaPathKey],
265 $metadataArray[self::$metaTypeKey]
280 throw new \InvalidArgumentException(
"Invalid visibility expected public or private but got \"$visibility\".");
deleteDir($path)
Deletes a directory recursive.
__construct(FilesystemInterface $flySystemFS, FlySystemFileAccess $fileAccess)
FlySystemDirectoryAccess constructor.
Class FlySystemFileAccess.
listContents($path='', $recursive=false)
Lists the content of a directory.
ensureDirectoryExistence($path)
Checks if the directory exists.
Class DirectoryNotFoundException.
hasDir($path)
Checks whether the directory exists or not.
Interface DirectoryAccess.
ensureEmptyDirectory($path)
Ensures that the given path does not exist or is empty.
copyDir($source, $destination)
Copy all childes of the source recursive to the destination.
const PRIVATE_ACCESS
Private file visibility.
createDir($path, $visibility=Visibility::PUBLIC_ACCESS)
Create a new directory.
arrayToMetadata(array $metadataArray)
Parses a metadata array into a metadata object.
Create styles array
The data for the language used.
Class FlySystemDirectoryAccess.
validateVisibility($visibility)
Validates if the given visibility is known, otherwise an exception is thrown.
const PUBLIC_ACCESS
Public file visibility.