Container
extends Container
in package
Automatically configures classes and dependencies.
Sets up an automatic registration for classes when requested through Pimple by looking up the class's constructor and arguments.
Tags
Table of Contents
- autoRegister() : string|null
- Returns a factory function for the passed class.
- extend() : callable
- Overridden to see if the class can be auto-registered first before calling Pimple\Container::extend
- offsetExists() : bool
- Overridden to see if the class can be auto-registered and return true if it can.
- offsetGet() : mixed
- Overridden to see if the class can be auto-registered and return an instance if it can.
- getParameterClass() : string|null
- Looks up the type of the passed ReflectionParameter and returns it as a fully qualified class name as expected by the class's auto registration.
Methods
autoRegister()
Returns a factory function for the passed class.
public
autoRegister(mixed $class) : string|null
The returned factory method looks up arguments and uses pimple to get an instance of those types to pass them during construction.
Parameters
- $class : mixed
Return values
string|null —extend()
Overridden to see if the class can be auto-registered first before calling Pimple\Container::extend
public
extend(string $id, callable $callable) : callable
Parameters
- $id : string
- $callable : callable
Return values
callable —the wrapped $callable
offsetExists()
Overridden to see if the class can be auto-registered and return true if it can.
public
offsetExists(mixed $id) : bool
Parameters
- $id : mixed
Return values
bool —offsetGet()
Overridden to see if the class can be auto-registered and return an instance if it can.
public
offsetGet(mixed $id) : mixed
Parameters
- $id : mixed
Tags
Return values
mixed —getParameterClass()
Looks up the type of the passed ReflectionParameter and returns it as a fully qualified class name as expected by the class's auto registration.
private
getParameterClass(ReflectionParameter $param) : string|null
Null is returned for built-in types.
Parameters
- $param : ReflectionParameter