class ReadThroughFilesystemAdapter implements FilesystemAdapter (View source)

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, $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.

readStream(string $path)

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

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 primary filesystem.

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.

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

__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

bool fileExists(string $path)

Determine if a file exists.

Parameters

string $path

Return Value

bool

bool directoryExists(string $path)

Determine if a directory exists.

Parameters

string $path

Return Value

bool

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

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

Write a file stream to the primary filesystem.

Parameters

string $path
$contents
Config $config

Return Value

void

string read(string $path)

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

Parameters

string $path

Return Value

string

readStream(string $path)

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

Parameters

string $path

void delete(string $path)

Delete a file from both filesystems.

Parameters

string $path

Return Value

void

void deleteDirectory(string $path)

Delete a directory from both filesystems.

Parameters

string $path

Return Value

void

void createDirectory(string $path, Config $config)

Create a directory on the primary filesystem.

Parameters

string $path
Config $config

Return Value

void

void setVisibility(string $path, string $visibility)

Set a file's visibility on the primary filesystem.

Parameters

string $path
string $visibility

Return Value

void

FileAttributes visibility(string $path)

Retrieve a file's visibility.

Parameters

string $path

Return Value

FileAttributes

FileAttributes mimeType(string $path)

Retrieve a file's MIME type.

Parameters

string $path

Return Value

FileAttributes

FileAttributes lastModified(string $path)

Retrieve a file's last modified time.

Parameters

string $path

Return Value

FileAttributes

FileAttributes fileSize(string $path)

Retrieve a file's size.

Parameters

string $path

Return Value

FileAttributes

iterable listContents(string $path, bool $deep)

List the contents of the primary filesystem.

Parameters

string $path
bool $deep

Return Value

iterable

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

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

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

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

protected FilesystemOperator readerFor(string $path)

Get the filesystem that contains the given path.

Parameters

string $path

Return Value

FilesystemOperator

protected void handlePromotionFailure(string $path, FilesystemException $exception)

Handle an exception encountered while promoting a file.

Parameters

string $path
FilesystemException $exception

Return Value

void