Singleton
Singleton trait.
trait Winter\Storm\Support\Traits\Singleton
Allows a simple interface for treating a class as a singleton. Usage: myObject::instance()
Methods
public __clone ()
Returns
mixed
public __wakeup ()
Returns
mixed
public
static
final
forgetInstance ($container = null
)
: void
Forget this singleton's instance if it exists
Parameters
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
Returns
void
public
static
final
instance ($container = null
)
: static
Create a new instance of this singleton.
Parameters
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
Returns
static
protected final __construct ()
Constructor.
Returns
mixed
protected init ()
Initialize the singleton free from constructor parameters.
Returns
mixed
Copyright © 2023 Winter CMS