trait Singleton

Properties

static protected $instances

Methods

__construct()

Protected class constructor to prevent direct object creation.

void
__clone()

Prevent object cloning

void
__wakeup()

Singletons should not be restorable from strings.

static Singleton
getInstance()

To return new or existing Singleton instance of the class from which it is called.

Details

at line 12
protected __construct()

Protected class constructor to prevent direct object creation.

at line 19
final protected void __clone()

Prevent object cloning

Return Value

void

at line 26
void __wakeup()

Singletons should not be restorable from strings.

Return Value

void

at line 37
final static Singleton getInstance()

To return new or existing Singleton instance of the class from which it is called.

As it sets to final it can't be overridden.

Return Value

Singleton

Singleton instance of the class.