class Container

The dependency injection container default implementation.

Constants

TAGS

TYPES

SERVICES

ALIASES

Properties

array $parameters
protected array[] $meta

Methods

__construct(array $params = [])

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.

string
getServiceType($name)

Gets the service type by name.

bool
hasService($name)

Does the service exist?

bool
isCreated($name)

Is the service created?

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

Creates new instance of the service.

object|null
getByType($type, $throw = true)

Resolves service by type.

string[]
findByType($type)

Gets the service names of the specified type.

array
findByTag($tag)

Gets the service names of the specified tag.

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

Creates new instance using autowiring.

void
callInjects($service)

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

mixed
callMethod(callable $function, array $args = [])

Calls method using autowiring.

mixed
expand($s) deprecated

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 41
__construct(array $params = [])

No description

Parameters

array $params

at line 50
array getParameters()

No description

Return Value

array

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

Adds the service to the container.

Parameters

$name
$service

Return Value

Container

at line 88
void removeService($name)

Removes the service from the container.

Parameters

$name

Return Value

void

at line 101
object getService($name)

Gets the service object by name.

Parameters

$name

Return Value

object

Exceptions

MissingServiceException

at line 119
string getServiceType($name)

Gets the service type by name.

Parameters

$name

Return Value

string

Exceptions

MissingServiceException

at line 138
bool hasService($name)

Does the service exist?

Parameters

$name

Return Value

bool

at line 152
bool isCreated($name)

Is the service created?

Parameters

$name

Return Value

bool

at line 168
object createService($name, array $args = [])

Creates new instance of the service.

Parameters

$name
array $args

Return Value

object

Exceptions

MissingServiceException

at line 202
object|null getByType($type, $throw = true)

Resolves service by type.

Parameters

$type
$throw

Return Value

object|null service

Exceptions

MissingServiceException

at line 224
string[] findByType($type)

Gets the service names of the specified type.

Parameters

$type

Return Value

string[]

at line 238
array findByTag($tag)

Gets the service names of the specified tag.

Parameters

$tag

Return Value

array

of [service name => tag attributes]

at line 254
object createInstance($class, array $args = [])

Creates new instance using autowiring.

Parameters

$class
array $args

Return Value

object

Exceptions

InvalidArgumentException

at line 275
void callInjects($service)

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

Parameters

$service

Return Value

void

at line 285
mixed callMethod(callable $function, array $args = [])

Calls method using autowiring.

Parameters

callable $function
array $args

Return Value

mixed

at line 300
mixed expand($s) deprecated

deprecated

Expands %placeholders%.

Parameters

$s

Return Value

mixed

at line 307
__get($name) deprecated

deprecated

No description

Parameters

$name

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

deprecated

No description

Parameters

$name
$service

at line 324
__isset($name) deprecated

deprecated

No description

Parameters

$name

at line 332
__unset($name) deprecated

deprecated

No description

Parameters

$name

at line 339
static getMethodName($name)

No description

Parameters

$name

Traits

SmartObject