class ContainerBuilder

Container builder.

Constants

THIS_SERVICE

THIS_CONTAINER

Properties

array $parameters

Methods

addDefinition($name, ServiceDefinition $definition = null)

Adds new service definition.

void
removeDefinition($name)

Removes the specified service definition.

getDefinition($name)

Gets the service definition.

getDefinitions()

Gets all service definitions.

bool
hasDefinition($name)

Does the service definition or alias exist?

addAlias($alias, $service)

No description

void
removeAlias($alias)

Removes the specified alias.

array
getAliases()

Gets all service aliases.

addExcludedClasses(array $types)

No description

setClassName($name) deprecated

No description

getClassName() deprecated

No description

string|null
getByType($type, $throw = false)

Resolves service name by type.

getDefinitionByType($type)

Gets the service definition of the specified type.

findByType($type)

Gets the service names and definitions of the specified type.

array
findByTag($tag)

Gets the service objects of the specified tag.

getClassList()

No description

void
prepareClassList()

Generates $dependencies, $classList and normalizes class names.

void
complete()

No description

completeStatement(Statement $statement)

No description

addDependency($dep)

Adds item to the list of dependencies.

array
getDependencies()

Returns the list of dependencies.

mixed
expand($value) deprecated

Expands %placeholders% in strings.

static PhpLiteral
literal($code, array $args = null)

No description

string|array
normalizeEntity($entity)

No description

string
getServiceName($arg)

Converts @service or @\Class -> service name and checks its existence.

array
autowireArguments($class, $method, array $arguments)

Creates a list of arguments using autowiring.

generateClasses($className = 'Container', $parentName = null) deprecated

No description

formatStatement(Statement $statement) deprecated

No description

formatPhp($statement, $args) deprecated

No description

Details

at line 58
ServiceDefinition addDefinition($name, ServiceDefinition $definition = null)

Adds new service definition.

Parameters

$name
ServiceDefinition $definition

Return Value

ServiceDefinition

at line 83
void removeDefinition($name)

Removes the specified service definition.

Parameters

$name

Return Value

void

at line 96
ServiceDefinition getDefinition($name)

Gets the service definition.

Parameters

$name

Return Value

ServiceDefinition

at line 110
ServiceDefinition[] getDefinitions()

Gets all service definitions.

Return Value

ServiceDefinition[]

at line 121
bool hasDefinition($name)

Does the service definition or alias exist?

Parameters

$name

Return Value

bool

at line 132
addAlias($alias, $service)

No description

Parameters

$alias
$service

at line 154
void removeAlias($alias)

Removes the specified alias.

Parameters

$alias

Return Value

void

at line 164
array getAliases()

Gets all service aliases.

Return Value

array

at line 174
ContainerBuilder addExcludedClasses(array $types)

No description

Parameters

array $types

Return Value

ContainerBuilder

at line 189
setClassName($name) deprecated

deprecated

No description

Parameters

$name

at line 199
getClassName() deprecated

deprecated

No description

at line 215
string|null getByType($type, $throw = false)

Resolves service name by type.

Parameters

$type
$throw

Return Value

string|null

service name or null

Exceptions

ServiceCreationException

at line 252
ServiceDefinition getDefinitionByType($type)

Gets the service definition of the specified type.

Parameters

$type

Return Value

ServiceDefinition

at line 263
ServiceDefinition[] findByType($type)

Gets the service names and definitions of the specified type.

Parameters

$type

Return Value

ServiceDefinition[]

at line 282
array findByTag($tag)

Gets the service objects of the specified tag.

Parameters

$tag

Return Value

array

of [service name => tag attributes]

at line 297
getClassList()

internal  
 

No description

at line 312
void prepareClassList()

internal  
 

Generates $dependencies, $classList and normalizes class names.

Return Value

void

at line 560
void complete()

No description

Return Value

void

at line 613
Statement completeStatement(Statement $statement)

No description

Parameters

Statement $statement

Return Value

Statement

at line 730
ContainerBuilder addDependency($dep)

internal  
 

Adds item to the list of dependencies.

Parameters

$dep

Return Value

ContainerBuilder

at line 741
array getDependencies()

Returns the list of dependencies.

Return Value

array

at line 752
mixed expand($value) deprecated

deprecated

Expands %placeholders% in strings.

Parameters

$value

Return Value

mixed

at line 761
static PhpLiteral literal($code, array $args = null)

No description

Parameters

$code
array $args

Return Value

PhpLiteral

at line 771
string|array normalizeEntity($entity)

internal  
 

No description

Parameters

$entity

Return Value

string|array

Class, @service, [Class, member], [@service, member], [, globalFunc], [Statement, member]

at line 796
string getServiceName($arg)

internal  
 

Converts @service or @\Class -> service name and checks its existence.

Parameters

$arg

Return Value

string

of false, if argument is not service name

at line 828
array autowireArguments($class, $method, array $arguments)

internal  
 

Creates a list of arguments using autowiring.

Parameters

$class
$method
array $arguments

Return Value

array

at line 848
generateClasses($className = 'Container', $parentName = null) deprecated

deprecated

No description

Parameters

$className
$parentName

at line 856
formatStatement(Statement $statement) deprecated

deprecated

No description

Parameters

Statement $statement

at line 864
formatPhp($statement, $args) deprecated

deprecated

No description

Parameters

$statement
$args

Traits

SmartObject