PHP 클래스 FOF30\Pimple\Container

저자: Fabien Potencier
상속: implements ArrayAccess
파일 보기 프로젝트 열기: akeeba/fof

공개 메소드들

메소드 설명
__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.

메소드 상세

__construct() 공개 메소드

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

extend() 공개 메소드

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
리턴 callable The wrapped callable

factory() 공개 메소드

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

keys() 공개 메소드

Returns all defined value names.
public keys ( ) : array
리턴 array An array of value names

offsetExists() 공개 메소드

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

offsetGet() 공개 메소드

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

offsetSet() 공개 메소드

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() 공개 메소드

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

protect() 공개 메소드

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
리턴 callable The passed callable

raw() 공개 메소드

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

register() 공개 메소드

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
리턴 static