class Container extends Object

The dependency injection container default implementation.

Constants

TAGS

TYPES

Properties

array $parameters
protected array[] $meta

Methods

__construct(array $params = array())

No description

array
getParameters()

No description

addService($name, $service)

Adds the service to the container.

void
removeService($name)

Removes the service from the container.

object
getService($name)

Gets the service object by name.

bool
hasService($name)

Does the service exist?

bool
isCreated($name)

Is the service created?

object
createService($name, array $args = array())

Creates new instance of the service.

object
getByType($class, $need = TRUE)

Resolves service by type.

string[]
findByType($class)

Gets the service names of the specified type.

array
findByTag($tag)

Gets the service names of the specified tag.

object
createInstance($class, array $args = array())

Creates new instance using autowiring.

void
callInjects($service)

Calls all methods starting with with "inject" using autowiring.

mixed
callMethod($function, array $args = array())

Calls method using autowiring.

mixed
expand($s)

Expands %placeholders%.

__get($name) deprecated

No description

__set($name, $service) deprecated

No description

__isset($name) deprecated

No description

__unset($name) deprecated

No description

static 
getMethodName($name)

No description

Details

at line 36
__construct(array $params = array())

No description

Parameters

array $params

at line 45
array getParameters()

No description

Return Value

array

at line 57
Container addService($name, $service)

Adds the service to the container.

Parameters

$name
$service

Return Value

Container

at line 87
void removeService($name)

Removes the service from the container.

Parameters

$name

Return Value

void

at line 99
object getService($name)

Gets the service object by name.

Parameters

$name

Return Value

object

Exceptions

MissingServiceException

at line 113
bool hasService($name)

Does the service exist?

Parameters

$name

Return Value

bool

at line 125
bool isCreated($name)

Is the service created?

Parameters

$name

Return Value

bool

at line 140
object createService($name, array $args = array())

Creates new instance of the service.

Parameters

$name
array $args

Return Value

object

Exceptions

MissingServiceException

at line 174
object getByType($class, $need = TRUE)

Resolves service by type.

Parameters

$class
$need

Return Value

object

service or NULL

Exceptions

MissingServiceException

at line 194
string[] findByType($class)

Gets the service names of the specified type.

Parameters

$class

Return Value

string[]

at line 206
array findByTag($tag)

Gets the service names of the specified tag.

Parameters

$tag

Return Value

array

of [service name => tag attributes]

at line 222
object createInstance($class, array $args = array())

Creates new instance using autowiring.

Parameters

$class
array $args

Return Value

object

Exceptions

InvalidArgumentException

at line 243
void callInjects($service)

Calls all methods starting with with "inject" using autowiring.

Parameters

$service

Return Value

void

at line 267
mixed callMethod($function, array $args = array())

Calls method using autowiring.

Parameters

$function
array $args

Return Value

mixed

at line 284
mixed expand($s)

Expands %placeholders%.

Parameters

$s

Return Value

mixed

at line 291
__get($name) deprecated

deprecated

No description

Parameters

$name

at line 300
__set($name, $service) deprecated

deprecated

No description

Parameters

$name
$service

at line 308
__isset($name) deprecated

deprecated

No description

Parameters

$name

at line 316
__unset($name) deprecated

deprecated

No description

Parameters

$name

at line 331
static getMethodName($name)

No description

Parameters

$name