class ContainerBuilder

Container builder.

Traits

Strict class for better experience.

Constants

THIS_SERVICE

THIS_CONTAINER

Properties

array $parameters

Methods

__construct()

No description

addDefinition(string|null $name, Definition $definition = null)

Adds new service definition.

addAccessorDefinition(string|null $name)

No description

addFactoryDefinition(string|null $name)

No description

addLocatorDefinition(string|null $name)

No description

addImportedDefinition(string|null $name)

No description

void
removeDefinition(string $name)

Removes the specified service definition.

getDefinition(string $name)

Gets the service definition.

array
getDefinitions()

Gets all service definitions.

bool
hasDefinition(string $name)

Does the service definition or alias exist?

void
addAlias(string $alias, string $service)

No description

void
removeAlias(string $alias)

Removes the specified alias.

array
getAliases()

Gets all service aliases.

addExcludedClasses(array $types)

No description

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

Resolves autowired service name by type.

getDefinitionByType(string $type)

Gets autowired service definition of the specified type.

array
findAutowired(string $type)

Gets the autowired service names and definitions of the specified type.

array
findByType(string $type)

Gets the service names and definitions of the specified type.

array
findByTag(string $tag)

Gets the service names and tag values.

void
resolve()

Checks services, resolves types and rebuilts autowiring classlist.

void
complete()

No description

addDependency(ReflectionClass|ReflectionFunctionAbstract|string $dep)

Adds item to the list of dependencies.

array
getDependencies()

Returns the list of dependencies.

array
exportMeta()

No description

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

No description

string
formatPhp(string $statement, array $args) deprecated

No description

void
prepareClassList() deprecated

No description

Details

at line 49
__construct()

at line 60
Definition addDefinition(string|null $name, Definition $definition = null)

Adds new service definition.

Parameters

string|null $name
Definition $definition

Return Value

Definition

at line 96
AccessorDefinition addAccessorDefinition(string|null $name)

Parameters

string|null $name

Return Value

AccessorDefinition

at line 102
FactoryDefinition addFactoryDefinition(string|null $name)

Parameters

string|null $name

Return Value

FactoryDefinition

at line 108
LocatorDefinition addLocatorDefinition(string|null $name)

Parameters

string|null $name

Return Value

LocatorDefinition

at line 114
ImportedDefinition addImportedDefinition(string|null $name)

Parameters

string|null $name

Return Value

ImportedDefinition

at line 123
void removeDefinition(string $name)

Removes the specified service definition.

Parameters

string $name

Return Value

void

at line 134
Definition getDefinition(string $name)

Gets the service definition.

Parameters

string $name

Return Value

Definition

at line 148
array getDefinitions()

Gets all service definitions.

Return Value

array

at line 157
bool hasDefinition(string $name)

Does the service definition or alias exist?

Parameters

string $name

Return Value

bool

at line 164
void addAlias(string $alias, string $service)

Parameters

string $alias
string $service

Return Value

void

at line 185
void removeAlias(string $alias)

Removes the specified alias.

Parameters

string $alias

Return Value

void

at line 194
array getAliases()

Gets all service aliases.

Return Value

array

at line 204
ContainerBuilder addExcludedClasses(array $types)

Parameters

array $types

Return Value

ContainerBuilder

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

Resolves autowired service name by type.

Parameters

string $type
bool $throw

Return Value

string|null

Exceptions

MissingServiceException

at line 228
Definition getDefinitionByType(string $type)

Gets autowired service definition of the specified type.

Parameters

string $type

Return Value

Definition

Exceptions

MissingServiceException

at line 239
array findAutowired(string $type)

Gets the autowired service names and definitions of the specified type.

Parameters

string $type

Return Value

array service name is key

at line 250
array findByType(string $type)

Gets the service names and definitions of the specified type.

Parameters

string $type

Return Value

array service name is key

at line 267
array findByTag(string $tag)

Gets the service names and tag values.

Parameters

string $tag

Return Value

array of [service name => tag attributes]

at line 285
void resolve()

Checks services, resolves types and rebuilts autowiring classlist.

Return Value

void

at line 313
void complete()

Return Value

void

at line 333
ContainerBuilder addDependency(ReflectionClass|ReflectionFunctionAbstract|string $dep)

Adds item to the list of dependencies.

Parameters

ReflectionClass|ReflectionFunctionAbstract|string $dep

Return Value

ContainerBuilder

at line 343
array getDependencies()

Returns the list of dependencies.

Return Value

array

at line 350
array exportMeta()

Return Value

array

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

Parameters

string $code
array $args

Return Value

PhpLiteral

at line 397
string formatPhp(string $statement, array $args) deprecated

deprecated

Parameters

string $statement
array $args

Return Value

string

at line 412
void prepareClassList() deprecated

deprecated use resolve()

Return Value

void