ReadThroughFilesystemAdapter
class ReadThroughFilesystemAdapter implements FilesystemAdapter
Methods
Create a new read-through filesystem adapter instance.
Determine if a file exists.
Determine if a directory exists.
Write a file to the primary filesystem.
Write a file stream to the primary filesystem.
Read a file, promoting it from the fallback filesystem when necessary.
Read a file stream, promoting it from the fallback filesystem when necessary.
Open a native range when no fallback promotion is needed.
Delete a file from both filesystems.
Delete a directory from both filesystems.
Create a directory on the primary filesystem.
Set a file's visibility on the filesystem containing it.
Retrieve a file's visibility.
Retrieve a file's MIME type.
Retrieve a file's last modified time.
Retrieve a file's size.
List the contents of the primary filesystem.
Move a file on the primary filesystem and remove its fallback source.
Copy a file on the primary filesystem, reading it from the fallback filesystem when necessary.
Move a file to its destination on the primary filesystem.
Copy a file from the fallback filesystem to the primary filesystem.
Spool the fallback file and release its lease before borrowing the primary.
Get the filesystem that contains the given path.
Handle an exception encountered while promoting a file.
Details
at line 25
__construct(FilesystemOperator $primary, FilesystemOperator $fallback, bool $throwOnPromotionFailure = false, bool $copy = true)
Create a new read-through filesystem adapter instance.
at line 36
bool
fileExists(string $path)
Determine if a file exists.
at line 44
bool
directoryExists(string $path)
Determine if a directory exists.
at line 52
void
write(string $path, string $contents, Config $config)
Write a file to the primary filesystem.
at line 62
void
writeStream(string $path, mixed $contents, Config $config)
Write a file stream to the primary filesystem.
at line 70
string
read(string $path)
Read a file, promoting it from the fallback filesystem when necessary.
at line 100
mixed
readStream(string $path)
Read a file stream, promoting it from the fallback filesystem when necessary.
at line 151
mixed
readStreamRange(string $path, int|null $start, int|null $end)
Open a native range when no fallback promotion is needed.
at line 165
void
delete(string $path)
Delete a file from both filesystems.
at line 177
void
deleteDirectory(string $path)
Delete a directory from both filesystems.
at line 189
void
createDirectory(string $path, Config $config)
Create a directory on the primary filesystem.
at line 197
void
setVisibility(string $path, string $visibility)
Set a file's visibility on the filesystem containing it.
at line 205
FileAttributes
visibility(string $path)
Retrieve a file's visibility.
at line 213
FileAttributes
mimeType(string $path)
Retrieve a file's MIME type.
at line 221
FileAttributes
lastModified(string $path)
Retrieve a file's last modified time.
at line 229
FileAttributes
fileSize(string $path)
Retrieve a file's size.
at line 237
iterable
listContents(string $path, bool $deep)
List the contents of the primary filesystem.
at line 245
void
move(string $source, string $destination, Config $config)
Move a file on the primary filesystem and remove its fallback source.
at line 261
void
copy(string $source, string $destination, Config $config)
Copy a file on the primary filesystem, reading it from the fallback filesystem when necessary.
at line 279
protected void
moveOnPrimary(string $source, string $destination, Config $config)
Move a file to its destination on the primary filesystem.
at line 297
protected void
copyFromFallback(string $source, string $destination, Config $config)
Copy a file from the fallback filesystem to the primary filesystem.
at line 315
protected mixed
spoolFallback(string $path)
Spool the fallback file and release its lease before borrowing the primary.
at line 342
protected FilesystemOperator
readerFor(string $path)
Get the filesystem that contains the given path.
at line 350
protected void
handlePromotionFailure(string $path, FilesystemException $exception)
Handle an exception encountered while promoting a file.