\FACTFinder\UtilPimple

Pimple main class.

Summary

Methods
Properties
Constants
__construct()
offsetSet()
offsetGet()
offsetExists()
offsetUnset()
factory()
protect()
raw()
extend()
keys()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$values
$factories
$protected
$frozen
$raw
$keys
N/A

Properties

$values

$values : 

Type

$factories

$factories : 

Type

$protected

$protected : 

Type

$frozen

$frozen : 

Type

$raw

$raw : 

Type

$keys

$keys : 

Type

Methods

__construct()

__construct(array  $values = array()) 

Instantiate the container.

Objects and parameters can be passed as argument to the constructor.

Parameters

array $values

The parameters or objects.

offsetSet()

offsetSet(string  $id, mixed  $value) 

Sets a parameter or an object.

Objects must be defined as Closures.

Allowing any PHP callable leads to difficult to debug problems as function names (strings) are callable (creating a function with the same name as an existing parameter would break your container).

Parameters

string $id

The unique identifier for the parameter or object

mixed $value

The value of the parameter or a closure to define an object

Throws

\FACTFinder\Util\RuntimeException

Prevent override of a frozen service

offsetGet()

offsetGet(string  $id) : mixed

Gets a parameter or an object.

Parameters

string $id

The unique identifier for the parameter or object

Throws

\FACTFinder\Util\InvalidArgumentException

if the identifier is not defined

Returns

mixed —

The value of the parameter or an object

offsetExists()

offsetExists(string  $id) : Boolean

Checks if a parameter or an object is set.

Parameters

string $id

The unique identifier for the parameter or object

Returns

Boolean

offsetUnset()

offsetUnset(string  $id) 

Unsets a parameter or an object.

Parameters

string $id

The unique identifier for the parameter or object

factory()

factory(callable  $callable) : callable

Marks a callable as being a factory service.

Parameters

callable $callable

A service definition to be used as a factory

Throws

\FACTFinder\Util\InvalidArgumentException

Service definition has to be a closure of an invokable object

Returns

callable —

The passed callable

protect()

protect(callable  $callable) : callable

Protects a callable from being interpreted as a service.

This is useful when you want to store a callable as a parameter.

Parameters

callable $callable

A callable to protect from being evaluated

Throws

\FACTFinder\Util\InvalidArgumentException

Service definition has to be a closure of an invokable object

Returns

callable —

The passed callable

raw()

raw(string  $id) : mixed

Gets a parameter or the closure defining an object.

Parameters

string $id

The unique identifier for the parameter or object

Throws

\FACTFinder\Util\InvalidArgumentException

if the identifier is not defined

Returns

mixed —

The value of the parameter or the closure defining an object

extend()

extend(string  $id, callable  $callable) : callable

Extends an object definition.

Useful when you want to extend an existing object definition, without necessarily loading that object.

Parameters

string $id

The unique identifier for the object

callable $callable

A service definition to extend the original

Throws

\FACTFinder\Util\InvalidArgumentException

if the identifier is not defined or not a service definition

Returns

callable —

The wrapped callable

keys()

keys() : array

Returns all defined value names.

Returns

array —

An array of value names