class ReadThroughFilesystemAdapter implements FilesystemAdapter

Methods

__construct(FilesystemOperator $primary, FilesystemOperator $fallback, bool $throwOnPromotionFailure = false, bool $copy = true)

Create a new read-through filesystem adapter instance.

bool
fileExists(string $path)

Determine if a file exists.

bool
directoryExists(string $path)

Determine if a directory exists.

void
write(string $path, string $contents, Config $config)

Write a file to the primary filesystem.

void
writeStream(string $path, mixed $contents, Config $config)

Write a file stream to the primary filesystem.

string
read(string $path)

Read a file, promoting it from the fallback filesystem when necessary.

mixed
readStream(string $path)

Read a file stream, promoting it from the fallback filesystem when necessary.

mixed
readStreamRange(string $path, int|null $start, int|null $end)

Open a native range when no fallback promotion is needed.

void
delete(string $path)

Delete a file from both filesystems.

void
deleteDirectory(string $path)

Delete a directory from both filesystems.

void
createDirectory(string $path, Config $config)

Create a directory on the primary filesystem.

void
setVisibility(string $path, string $visibility)

Set a file's visibility on the filesystem containing it.

FileAttributes
visibility(string $path)

Retrieve a file's visibility.

FileAttributes
mimeType(string $path)

Retrieve a file's MIME type.

FileAttributes
lastModified(string $path)

Retrieve a file's last modified time.

FileAttributes
fileSize(string $path)

Retrieve a file's size.

iterable
listContents(string $path, bool $deep)

List the contents of the primary filesystem.

void
move(string $source, string $destination, Config $config)

Move a file on the primary filesystem and remove its fallback source.

void
copy(string $source, string $destination, Config $config)

Copy a file on the primary filesystem, reading it from the fallback filesystem when necessary.

void
moveOnPrimary(string $source, string $destination, Config $config)

Move a file to its destination on the primary filesystem.

void
copyFromFallback(string $source, string $destination, Config $config)

Copy a file from the fallback filesystem to the primary filesystem.

mixed
spoolFallback(string $path)

Spool the fallback file and release its lease before borrowing the primary.

FilesystemOperator
readerFor(string $path)

Get the filesystem that contains the given path.

void
handlePromotionFailure(string $path, FilesystemException $exception)

Handle an exception encountered while promoting a file.

Details

at line 24
__construct(FilesystemOperator $primary, FilesystemOperator $fallback, bool $throwOnPromotionFailure = false, bool $copy = true)

Create a new read-through filesystem adapter instance.

Parameters

FilesystemOperator $primary
FilesystemOperator $fallback
bool $throwOnPromotionFailure
bool $copy

at line 35
bool fileExists(string $path)

Determine if a file exists.

Parameters

string $path

Return Value

bool

at line 43
bool directoryExists(string $path)

Determine if a directory exists.

Parameters

string $path

Return Value

bool

at line 51
void write(string $path, string $contents, Config $config)

Write a file to the primary filesystem.

Parameters

string $path
string $contents
Config $config

Return Value

void

at line 61
void writeStream(string $path, mixed $contents, Config $config)

Write a file stream to the primary filesystem.

Parameters

string $path
mixed $contents
Config $config

Return Value

void

at line 69
string read(string $path)

Read a file, promoting it from the fallback filesystem when necessary.

Parameters

string $path

Return Value

string

at line 99
mixed readStream(string $path)

Read a file stream, promoting it from the fallback filesystem when necessary.

Parameters

string $path

Return Value

mixed

at line 150
mixed readStreamRange(string $path, int|null $start, int|null $end)

Open a native range when no fallback promotion is needed.

Parameters

string $path
int|null $start
int|null $end

Return Value

mixed

null when the normal read-and-seek path is required

at line 164
void delete(string $path)

Delete a file from both filesystems.

Parameters

string $path

Return Value

void

at line 176
void deleteDirectory(string $path)

Delete a directory from both filesystems.

Parameters

string $path

Return Value

void

at line 188
void createDirectory(string $path, Config $config)

Create a directory on the primary filesystem.

Parameters

string $path
Config $config

Return Value

void

at line 196
void setVisibility(string $path, string $visibility)

Set a file's visibility on the filesystem containing it.

Parameters

string $path
string $visibility

Return Value

void

at line 204
FileAttributes visibility(string $path)

Retrieve a file's visibility.

Parameters

string $path

Return Value

FileAttributes

at line 212
FileAttributes mimeType(string $path)

Retrieve a file's MIME type.

Parameters

string $path

Return Value

FileAttributes

at line 220
FileAttributes lastModified(string $path)

Retrieve a file's last modified time.

Parameters

string $path

Return Value

FileAttributes

at line 228
FileAttributes fileSize(string $path)

Retrieve a file's size.

Parameters

string $path

Return Value

FileAttributes

at line 236
iterable listContents(string $path, bool $deep)

List the contents of the primary filesystem.

Parameters

string $path
bool $deep

Return Value

iterable

at line 244
void move(string $source, string $destination, Config $config)

Move a file on the primary filesystem and remove its fallback source.

Parameters

string $source
string $destination
Config $config

Return Value

void

at line 260
void copy(string $source, string $destination, Config $config)

Copy a file on the primary filesystem, reading it from the fallback filesystem when necessary.

Parameters

string $source
string $destination
Config $config

Return Value

void

at line 278
protected void moveOnPrimary(string $source, string $destination, Config $config)

Move a file to its destination on the primary filesystem.

Parameters

string $source
string $destination
Config $config

Return Value

void

at line 296
protected void copyFromFallback(string $source, string $destination, Config $config)

Copy a file from the fallback filesystem to the primary filesystem.

Parameters

string $source
string $destination
Config $config

Return Value

void

at line 314
protected mixed spoolFallback(string $path)

Spool the fallback file and release its lease before borrowing the primary.

Parameters

string $path

Return Value

mixed

at line 341
protected FilesystemOperator readerFor(string $path)

Get the filesystem that contains the given path.

Parameters

string $path

Return Value

FilesystemOperator

at line 349
protected void handlePromotionFailure(string $path, FilesystemException $exception)

Handle an exception encountered while promoting a file.

Parameters

string $path
FilesystemException $exception

Return Value

void