LaravelIoC

Summary

No protected properties found
N/A
No private methods found
No private properties found
N/A
File
ioc.php
Package
Default
Class hierarchy
LaravelIoC

Tags

None found

Properties

$registry

$registry : array

The registered dependencies.

Type

array

Tags

None found

$singletons

$singletons : array

The resolved singleton instances.

Type

array

Tags

None found

Methods

register()

register(string  $name, mixed  $resolver = null, boolean  $singleton = false) : void

Register an object and its resolver.

Parameters

string $name
mixed $resolver
boolean $singleton

static

Tags

None found

unregister()

unregister(string  $name) 

Unregister an object

Parameters

string $name

static

Tags

None found

registered()

registered(string  $name) : boolean

Determine if an object has been registered in the container.

Parameters

string $name

Returns

boolean

static

Tags

None found

singleton()

singleton(string  $name, \Closure  $resolver = null) : void

Register an object as a singleton.

Singletons will only be instantiated the first time they are resolved.

Parameters

string $name
Closure $resolver

static

Tags

None found

instance()

instance(string  $name, mixed  $instance) : void

Register an existing instance as a singleton.

// Register an instance as a singleton in the container IoC::instance('mailer', new Mailer);

Parameters

string $name
mixed $instance

static

Tags

None found

resolve()

resolve(string  $type, array  $parameters = array()) : mixed

Resolve a given type to an instance.

// Get an instance of the "mailer" object registered in the container $mailer = IoC::resolve('mailer');

// Get an instance of the "mailer" object and pass parameters to the resolver
$mailer = IoC::resolve('mailer', array('test'));

Parameters

string $type
array $parameters

Returns

mixed

static

Tags

None found

build()

build(string  $type, array  $parameters = array()) : mixed

Instantiate an instance of the given type.

Parameters

string $type
array $parameters

Throws

Exception

Returns

mixed

static

Tags

None found

dependencies()

dependencies(array  $parameters, array  $arguments) : array

Resolve all of the dependencies from the ReflectionParameters.

Parameters

array $parameters
array $arguments

that might have been passed into our resolve

Returns

array

static

Tags

None found

resolveNonClass()

resolveNonClass(  $parameter) : \Laravel\default

Resolves optional parameters for our dependency injection pretty much took backport straight from L4's IlluminateContainer

Parameters

$parameter

Throws

Exception

Returns

Laraveldefault —

value

static

Tags

None found