PHP Class FOF30\Pimple\Container

Author: Fabien Potencier
Inheritance: implements ArrayAccess
Afficher le fichier Open project: akeeba/fof

Méthodes publiques

Méthode Description
__construct ( array $values = [] ) Instantiate the container.
extend ( string $id, callable $callable ) : callable Extends an object definition.
factory ( callable $callable ) : callable Marks a callable as being a factory service.
keys ( ) : array Returns all defined value names.
offsetExists ( string $id ) : boolean Checks if a parameter or an object is set.
offsetGet ( string $id ) : mixed Gets a parameter or an object.
offsetSet ( string $id, mixed $value ) Sets a parameter or an object.
offsetUnset ( string $id ) Unsets a parameter or an object.
protect ( callable $callable ) : callable Protects a callable from being interpreted as a service.
raw ( string $id ) : mixed Gets a parameter or the closure defining an object.
register ( FOF30\Pimple\ServiceProviderInterface $provider, array $values = [] ) : static Registers a service provider.

Method Details

__construct() public méthode

Objects and parameters can be passed as argument to the constructor.
public __construct ( array $values = [] )
$values array The parameters or objects.

extend() public méthode

Useful when you want to extend an existing object definition, without necessarily loading that object.
public extend ( string $id, callable $callable ) : callable
$id string The unique identifier for the object
$callable callable A service definition to extend the original
Résultat callable The wrapped callable

factory() public méthode

Marks a callable as being a factory service.
public factory ( callable $callable ) : callable
$callable callable A service definition to be used as a factory
Résultat callable The passed callable

keys() public méthode

Returns all defined value names.
public keys ( ) : array
Résultat array An array of value names

offsetExists() public méthode

Checks if a parameter or an object is set.
public offsetExists ( string $id ) : boolean
$id string The unique identifier for the parameter or object
Résultat boolean

offsetGet() public méthode

Gets a parameter or an object.
public offsetGet ( string $id ) : mixed
$id string The unique identifier for the parameter or object
Résultat mixed The value of the parameter or an object

offsetSet() public méthode

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).
public offsetSet ( string $id, mixed $value )
$id string The unique identifier for the parameter or object
$value mixed The value of the parameter or a closure to define an object

offsetUnset() public méthode

Unsets a parameter or an object.
public offsetUnset ( string $id )
$id string The unique identifier for the parameter or object

protect() public méthode

This is useful when you want to store a callable as a parameter.
public protect ( callable $callable ) : callable
$callable callable A callable to protect from being evaluated
Résultat callable The passed callable

raw() public méthode

Gets a parameter or the closure defining an object.
public raw ( string $id ) : mixed
$id string The unique identifier for the parameter or object
Résultat mixed The value of the parameter or the closure defining an object

register() public méthode

Registers a service provider.
public register ( FOF30\Pimple\ServiceProviderInterface $provider, array $values = [] ) : static
$provider FOF30\Pimple\ServiceProviderInterface A ServiceProviderInterface instance
$values array An array of values that customizes the provider
Résultat static