interface ResourcePoolInterface

ResourcePoolInterface.

Classes implementing this interface represent a pool which contains ResourceInterface objects. This can be used for local storage and to simplify dependency handling between resources.

Methods

bool
save(ResourceInterface $resource)

Saves the given resource into the pool.

get(string $type, string $id, array $options = [])

Returns the resource for the given key.

has(string $type, string $id, array $options = [])

Returns whether the pool contains the given resource.

generateKey(string $type, string $id, array $options = [])

Generates a unique key for the given data.

Details

at line 30
bool save(ResourceInterface $resource)

Saves the given resource into the pool.

Parameters

ResourceInterface $resource

Return Value

bool True is the resource was successfully added, false if it was already present

Exceptions

RuntimeException If the saving process fails

at line 37
get(string $type, string $id, array $options = [])

Returns the resource for the given key.

Parameters

string $type
string $id
array $options

Exceptions

OutOfBoundsException If the given key does not represent any stored resource

at line 42
has(string $type, string $id, array $options = [])

Returns whether the pool contains the given resource.

Parameters

string $type
string $id
array $options

at line 47
generateKey(string $type, string $id, array $options = [])

Generates a unique key for the given data.

Parameters

string $type
string $id
array $options