class ContainerBuilder

Container builder.

Constants

ThisService

ThisContainer

THIS_SERVICE

THIS_CONTAINER

Properties

array<string,mixed> $parameters

Methods

__construct()

No description

addDefinition(string|null $name, Definition|null $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)

No description

array
getAliases()

Gets all service aliases.

addExcludedClasses(array $types)

Excludes classes from autowiring.

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()

Resolves service types and rebuilds the autowiring class list.

void
complete()

Completes all service definitions by resolving and wiring arguments.

addDependency(ReflectionClass|ReflectionFunctionAbstract|string $dep)

Adds item to the list of dependencies.

array
getDependencies()

Returns the list of dependencies.

array
exportMeta()

No description

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

Creates a PHP literal value, optionally formatted with arguments.

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

No description

Details

at line 46
__construct()

No description

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

Adds new service definition.

Parameters

string|null $name
Definition|null $definition

Return Value

Definition

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

No description

Parameters

string|null $name

Return Value

AccessorDefinition

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

No description

Parameters

string|null $name

Return Value

FactoryDefinition

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

No description

Parameters

string|null $name

Return Value

LocatorDefinition

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

No description

Parameters

string|null $name

Return Value

ImportedDefinition

at line 127
void removeDefinition(string $name)

Removes the specified service definition.

Parameters

string $name

Return Value

void

at line 138
Definition getDefinition(string $name)

Gets the service definition.

Parameters

string $name

Return Value

Definition

at line 153
array getDefinitions()

Gets all service definitions.

Return Value

array

at line 162
bool hasDefinition(string $name)

Does the service definition or alias exist?

Parameters

string $name

Return Value

bool

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

No description

Parameters

string $alias
string $service

Return Value

void

at line 188
void removeAlias(string $alias)

No description

Parameters

string $alias

Return Value

void

at line 198
array getAliases()

Gets all service aliases.

Return Value

array

at line 208
ContainerBuilder addExcludedClasses(array $types)

Excludes classes from autowiring.

Parameters

array $types

Return Value

ContainerBuilder

at line 223
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
NotAllowedDuringResolvingException

at line 235
Definition getDefinitionByType(string $type)

Gets autowired service definition of the specified type.

Parameters

string $type

Return Value

Definition

Exceptions

MissingServiceException

at line 248
array findAutowired(string $type)

internal  
 

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

Parameters

string $type

Return Value

array

Exceptions

NotAllowedDuringResolvingException

at line 261
array findByType(string $type)

Gets the service names and definitions of the specified type.

Parameters

string $type

Return Value

array

Exceptions

NotAllowedDuringResolvingException

at line 279
array findByTag(string $tag)

Gets the service names and tag values.

Parameters

string $tag

Return Value

array

service name => tag value

at line 298
void resolve()

Resolves service types and rebuilds the autowiring class list.

Return Value

void

at line 330
void complete()

Completes all service definitions by resolving and wiring arguments.

Return Value

void

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

internal  
 

Adds item to the list of dependencies.

Parameters

ReflectionClass|ReflectionFunctionAbstract|string $dep

Return Value

ContainerBuilder

at line 360
array getDependencies()

Returns the list of dependencies.

Return Value

array

at line 370
array exportMeta()

internal  
 

No description

Return Value

array

at line 409
static Literal literal(string $code, array|null $args = null)

Creates a PHP literal value, optionally formatted with arguments.

Parameters

string $code
array|null $args

Return Value

Literal

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

deprecated

No description

Parameters

string $statement
array $args

Return Value

string