final class File

The wrapper of League\Flysystem\Filesystem.

Methods

string
read(string $location)

Read a file.

string
readSql(string $location)

Read a sql file without comments.

void
write(string $location, string $content, bool $force = false)

Write a content to a file.

void
touch(string $location, bool $force = false)

Write a empty content to a file.

void
delete(string $location)

Delete a file.

void
deleteDictionary(string $path, string|null $ext = null)

Delete all files in a directory.

static File
system()

Create a instance of the class.

Details

at line 26
string read(string $location)

Read a file.

Parameters

string $location

Return Value

string

The method returns the string representation.

Exceptions

UnableToWriteFile
FilesystemException

at line 39
string readSql(string $location)

Read a sql file without comments.

Parameters

string $location

Return Value

string

The method returns the string representation without comments.

Exceptions

UnableToWriteFile
FilesystemException

at line 57
void write(string $location, string $content, bool $force = false)

Write a content to a file.

Parameters

string $location
string $content
bool $force

Whether to force writing of the file or not (default false)

Return Value

void

Exceptions

RuntimeException
UnableToWriteFile
FilesystemException

at line 75
void touch(string $location, bool $force = false)

Write a empty content to a file.

Parameters

string $location
bool $force

Whether to force writing of the file or not (default false)

Return Value

void

Exceptions

RuntimeException
UnableToWriteFile
FilesystemException

at line 86
void delete(string $location)

Delete a file.

Parameters

string $location

Return Value

void

Exceptions

UnableToWriteFile
FilesystemException

at line 96
void deleteDictionary(string $path, string|null $ext = null)

Delete all files in a directory.

Parameters

string $path
string|null $ext

The extension of the files to be deleted.

Return Value

void

at line 114
static File system()

Create a instance of the class.

Return Value

File

The method returns the current instance that enables method chaining.