Methods summary
public static
|
#
register( string $name, mixed $resolver = null, boolean $singleton = false )
Register an object and its resolver.
Register an object and its resolver.
Parameters
- $name
string $name
- $resolver
mixed $resolver
- $singleton
boolean $singleton
|
public static
|
#
unregister( string $name )
Unregister an object
Parameters
|
public static
boolean
|
#
registered( string $name )
Determine if an object has been registered in the container.
Determine if an object has been registered in the container.
Parameters
Returns
boolean
|
public static
|
#
singleton( string $name, Closure $resolver = null )
Register an object as a singleton.
Register an object as a singleton.
Singletons will only be instantiated the first time they are resolved.
Parameters
- $name
string $name
- $resolver
Closure
$resolver
|
public static
|
#
instance( string $name, mixed $instance )
Register an existing instance as a singleton.
Register an existing instance as a singleton.
IoC::instance('mailer', new Mailer);
Parameters
- $name
string $name
- $instance
mixed $instance
|
public static
mixed
|
#
resolve( string $type, array $parameters = array() )
Resolve a given type to an instance.
Resolve a given type to an instance.
$mailer = IoC::resolve('mailer');
$mailer = IoC::resolve('mailer', array('test'));
Parameters
- $type
string $type
- $parameters
array $parameters
Returns
mixed
|
protected static
mixed
|
#
build( string $type, array $parameters = array() )
Instantiate an instance of the given type.
Instantiate an instance of the given type.
Parameters
- $type
string $type
- $parameters
array $parameters
Returns
mixed
Throws
|
protected static
array
|
#
dependencies( array $parameters, array $arguments )
Resolve all of the dependencies from the ReflectionParameters.
Resolve all of the dependencies from the ReflectionParameters.
Parameters
- $parameters
array $parameters
- $arguments
array $arguments that might have been passed into our resolve
Returns
array
|
protected static
default
|
#
resolveNonClass( ReflectionParameter $parameter )
Resolves optional parameters for our dependency injection pretty much took
backport straight from L4's Illuminate\Container
Resolves optional parameters for our dependency injection pretty much took
backport straight from L4's Illuminate\Container
Parameters
Returns
default value
Throws
|