class ContainerBuilder extends Object

Basic container builder.

Constants

THIS_SERVICE

THIS_CONTAINER

Properties

array $parameters
string $currentService

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.

setClassName($name)

No description

string
getClassName()

No description

string|null
getByType($class)

Resolves service name by type.

findByType($class)

Gets the service names and definitions of the specified type.

array
findByTag($tag)

Gets the service objects of the specified tag.

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

Creates a list of arguments using autowiring.

array
prepareClassList()

Generates $dependencies, $classes and normalizes class names.

addExcludedClasses(array $classes)

No description

addDependency($file)

Adds a file to the list of dependencies.

array
getDependencies()

Returns the list of dependent files.

ClassType[]
generateClasses($className = NULL, $parentName = NULL)

Generates PHP classes. First class is the container.

string
formatStatement(Statement $statement)

Formats PHP code for class instantiating, function calling or property setting in PHP.

string
formatPhp($statement, $args)

Formats PHP statement.

mixed
expand($value) deprecated

Expands %placeholders% in strings.

static PhpLiteral
literal($phpCode)

No description

normalizeEntity($entity)

No description

string
getServiceName($arg)

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

Details

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

Adds new service definition.

Parameters

$name
ServiceDefinition $definition

Return Value

ServiceDefinition

at line 76
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 155
void removeAlias($alias)

Removes the specified alias.

Parameters

$alias

Return Value

void

at line 165
array getAliases()

Gets all service aliases.

Return Value

array

at line 174
ContainerBuilder setClassName($name)

No description

Parameters

$name

Return Value

ContainerBuilder

at line 184
string getClassName()

No description

Return Value

string

at line 199
string|null getByType($class)

Resolves service name by type.

Parameters

$class

Return Value

string|null

service name or NULL

Exceptions

ServiceCreationException

at line 228
ServiceDefinition[] findByType($class)

Gets the service names and definitions of the specified type.

Parameters

$class

Return Value

ServiceDefinition[]

at line 247
array findByTag($tag)

Gets the service objects of the specified tag.

Parameters

$tag

Return Value

array

of [service name => tag attributes]

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

Creates a list of arguments using autowiring.

Parameters

$class
$method
array $arguments

Return Value

array

at line 287
array prepareClassList()

internal  
 

Generates $dependencies, $classes and normalizes class names.

Return Value

array

at line 508
ContainerBuilder addExcludedClasses(array $classes)

No description

Parameters

array $classes

Return Value

ContainerBuilder

at line 520
ContainerBuilder addDependency($file)

internal  
 

Adds a file to the list of dependencies.

Parameters

$file

Return Value

ContainerBuilder

at line 531
array getDependencies()

Returns the list of dependent files.

Return Value

array

at line 545
ClassType[] generateClasses($className = NULL, $parentName = NULL)

Generates PHP classes. First class is the container.

Parameters

$className
$parentName

Return Value

ClassType[]

at line 689
string formatStatement(Statement $statement)

internal  
 

Formats PHP code for class instantiating, function calling or property setting in PHP.

Parameters

Statement $statement

Return Value

string

at line 765
string formatPhp($statement, $args)

internal  
 

Formats PHP statement.

Parameters

$statement
$args

Return Value

string

at line 812
mixed expand($value) deprecated

deprecated

Expands %placeholders% in strings.

Parameters

$value

Return Value

mixed

at line 821
static PhpLiteral literal($phpCode)

No description

Parameters

$phpCode

Return Value

PhpLiteral

at line 828
normalizeEntity($entity)

internal  
 

No description

Parameters

$entity

at line 852
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