class storage

Experimental

Properties

protected adapter_interface $adapter
protected adapter_factory $factory
protected file_tracker $file_tracker
protected string $storage_name

Methods

__construct(adapter_factory $factory, file_tracker $file_tracker, string $storage_name)

Constructor

string
get_name()

Returns storage name

mixed
get_adapter()

Returns an adapter instance

resource
read(string $path)

Reads a file as a stream

void
write(string $path, resource $resource)

Writes a new file using a stream

void
delete(string $path)

Removes files or directories

bool
exists(string $path)

Checks the existence of files or directories

int
file_size(string $path)

Get file size in bytes

int
total_files()

Return the number of files stored in this storage

float
total_size()

Get total storage size

float
free_space()

Get space available in bytes

Details

at line 51
__construct(adapter_factory $factory, file_tracker $file_tracker, string $storage_name)

Constructor

Parameters

adapter_factory $factory
file_tracker $file_tracker
string $storage_name

at line 63
string get_name()

Returns storage name

Return Value

string

at line 73
protected mixed get_adapter()

Returns an adapter instance

Return Value

mixed

at line 93
resource read(string $path)

Reads a file as a stream

Parameters

string $path

File to read

Return Value

resource

Returns a file pointer

Exceptions

storage_exception

at line 112
void write(string $path, resource $resource)

Writes a new file using a stream

Parameters

string $path

The target file

resource $resource

The resource

Return Value

void

Exceptions

storage_exception

at line 136
void delete(string $path)

Removes files or directories

Parameters

string $path

file/directory to remove

Return Value

void

Exceptions

storage_exception

at line 154
bool exists(string $path)

Checks the existence of files or directories

Parameters

string $path

file/directory to check

Return Value

bool

Returns true if the file/directory exist, false otherwise

at line 166
int file_size(string $path)

Get file size in bytes

Parameters

string $path

The file

Return Value

int

Size in bytes.

at line 176
int total_files()

Return the number of files stored in this storage

Return Value

int

Number of files.

at line 186
float total_size()

Get total storage size

Return Value

float

Size in bytes

at line 198
float free_space()

Get space available in bytes

Return Value

float

Returns available space

Exceptions

storage_exception