Documentation

rex_instance_pool_trait

Instance Pool Trait.

Tags
author

gharlan

Table of Contents

Methods

clearInstance()  : void
Removes the instance of the given key.
clearInstancePool()  : void
Clears the instance pool.
addInstance()  : void
Adds an instance.
getInstance()  : static|null
Returns the instance for the given key.
hasInstance()  : bool
Checks whether an instance exists for the given key.

Methods

clearInstance()

Removes the instance of the given key.

public static clearInstance(mixed $key) : void
Parameters
$key : mixed

Key

clearInstancePool()

Clears the instance pool.

public static clearInstancePool() : void

addInstance()

Adds an instance.

protected static addInstance(mixed $key, self $instance) : void
Parameters
$key : mixed

Key

$instance : self

Instance

getInstance()

Returns the instance for the given key.

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

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

Parameters
$key : mixed

Key

$createCallback : callable = null

Callback, will be called to create a new instance

Tags
psalm-param

callable(mixed...):?static $createCallback

Return values
static|null

hasInstance()

Checks whether an instance exists for the given key.

protected static hasInstance(mixed $key) : bool
Parameters
$key : mixed

Key

Return values
bool

        
On this page

Search results