\TriTanContainer

Container API: Implements a simple PSR-11 container.

Summary

Methods
Properties
Constants
resetInstance()
getInstance()
get()
has()
set()
add()
getAll()
clear()
No public properties found
No constants found
No protected methods found
$container
$instance
N/A
No private methods found
No private properties found
N/A

Properties

$container

$container : 

Type

$instance

$instance : self

Type

self — The stored singleton instance

Methods

resetInstance()

resetInstance() 

Reset the Container instance.

getInstance()

getInstance() : self

Creates the original or retrieves the stored singleton instance

Returns

self

get()

get(string  $name, mixed  $default = null) : mixed

Retrieves a container parameter.

Parameters

string $name

A container parameter name

mixed $default

A default container parameter value

Returns

mixed —

A container parameter value, if the container parameter exists, otherwise null

has()

has(string  $name) : boolean

Indicates whether or not a container parameter exists.

Parameters

string $name

A container parameter name

Returns

boolean —

true, if the container parameter exists, otherwise false

set()

set(string  $name, mixed  $value) 

Sets a container parameter.

If a container parameter with the name already exists the value will be overridden.

Parameters

string $name

A container parameter name

mixed $value

A container parameter value

add()

add(array  $parameters = array()) 

Sets an array of container parameters.

If an existing container parameter name matches any of the keys in the supplied array, the associated value will be overridden.

Parameters

array $parameters

An associative array of container parameters and their associated values

getAll()

getAll() : array

Retrieves all configuration parameters.

Returns

array —

An associative array of configuration parameters.

clear()

clear() 

Clears all current container parameters.