API Documentation (v0.9.0-alpha)

Avolutions\Core\AbstractSingleton

An abstract class which implements the singleton pattern.

Properties

Property Visibility Type Description
$instances protected array An array of all instance of singleton classes

Methods

Method Visibility Description
getInstance() public Returns an instance of the called class. If there is no instance so far, a new instance is created and returned. Otherwise, the existing one is returned (singleton).
setInstance() public Set the instance of the given class.

Property Details

$instances

An array of all instance of singleton classes

protected static array<string|int, mixed> $instances = []

Method Details

getInstance()

Returns an instance of the called class. If there is no instance so far, a new instance is created and returned. Otherwise, the existing one is returned (singleton).

public final static getInstance() : object
Return values
object Returns an instance of the called class. If there is no instance so far, a new instance is created and returned. Otherwise, the existing one is returned (singleton).
setInstance()

Set the instance of the given class.

public final static setInstance(mixed $class) : void
Parameters

mixed $class
The class to set.

Return values
void Set the instance of the given class.