\rex_instance_pool_trait

Instance Pool Trait.

Summary

Methods
Properties
Constants
clearInstance()
clearInstancePool()
No public properties found
No constants found
addInstance()
hasInstance()
getInstance()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

clearInstance()

clearInstance(mixed  $key) : mixed

Removes the instance of the given key.

Parameters

mixed $key

Key

Returns

mixed —

clearInstancePool()

clearInstancePool() : mixed

Clears the instance pool.

Returns

mixed —

addInstance()

addInstance(mixed  $key, self  $instance) : mixed

Adds an instance.

Parameters

mixed $key

Key

self $instance

Instance

Returns

mixed —

hasInstance()

hasInstance(mixed  $key) : bool

Checks whether an instance exists for the given key.

Parameters

mixed $key

Key

Returns

bool —

getInstance()

getInstance(mixed  $key, callable  $createCallback = null) : null|static

Returns the instance for the given key.

If the instance does not exist it will be created by calling the $createCallback

Parameters

mixed $key

Key

callable $createCallback

Callback, will be called to create a new instance

Returns

null|static —