Singleton trait allows a simple interface for treating a class as a singleton Usage: myObject::instance()

Protected Properties

protected static ?static $instance

Public Methods

public static forgetInstance()

public static forgetInstance(): void

forgetInstance if it exists

public static instance()

public static instance(): void

instance create a new instance of this singleton

Protected Methods

protected __construct()

protected __construct(): void

protected init()

protected init(): void

init the singleton free from constructor parameters