class Compiler

DI container compiler.

Constants

private Services

private Parameters

private DI

Methods

__construct(ContainerBuilder $builder = new ContainerBuilder())

No description

addExtension(string|null $name, CompilerExtension $extension)

Adds a compiler extension. Pass null as name to auto-assign a name.

array
getExtensions(string|null $type = null)

Returns all registered extensions, optionally filtered by type.

setClassName(string $className)

Sets the class name of the generated container.

addConfig(array $config)

Adds new configuration.

loadConfig(string $file, Loader|null $loader = null)

Adds new configuration from file.

array
getConfig() deprecated

Returns configuration.

setDynamicParameterNames(array $names)

Sets the names of dynamic parameters.

addDependencies(array $deps)

Adds dependencies to the list.

array
exportDependencies()

Exports dependencies.

addExportedTag(string $tag)

Adds a tag to export from the container.

addExportedType(string $type)

Adds a type to export from the container.

string
compile()

Compiles the container and returns the generated PHP code.

void
processExtensions()

No description

string
generateCode()

No description

void
loadDefinitionsFromConfig(array $configList)

Loads list of service definitions from configuration.

createPhpGenerator()

No description

createLoader(array $params = [])

No description

Details

at line 38
__construct(ContainerBuilder $builder = new ContainerBuilder())

No description

Parameters

ContainerBuilder $builder

at line 50
Compiler addExtension(string|null $name, CompilerExtension $extension)

Adds a compiler extension. Pass null as name to auto-assign a name.

Parameters

string|null $name
CompilerExtension $extension

Return Value

Compiler

at line 80
array getExtensions(string|null $type = null)

Returns all registered extensions, optionally filtered by type.

Parameters

string|null $type

Return Value

array

at line 88
ContainerBuilder getContainerBuilder()

No description

Return Value

ContainerBuilder

at line 97
Compiler setClassName(string $className)

Sets the class name of the generated container.

Parameters

string $className

Return Value

Compiler

at line 108
Compiler addConfig(array $config)

Adds new configuration.

Parameters

array $config

Return Value

Compiler

at line 122
Compiler loadConfig(string $file, Loader|null $loader = null)

Adds new configuration from file.

Parameters

string $file
Loader|null $loader

Return Value

Compiler

at line 141
array getConfig() deprecated

deprecated

Returns configuration.

Return Value

array

at line 151
Compiler setDynamicParameterNames(array $names)

Sets the names of dynamic parameters.

Parameters

array $names

Return Value

Compiler

at line 163
Compiler addDependencies(array $deps)

Adds dependencies to the list.

Parameters

array $deps

Return Value

Compiler

at line 174
array exportDependencies()

Exports dependencies.

Return Value

array

at line 183
Compiler addExportedTag(string $tag)

Adds a tag to export from the container.

Parameters

string $tag

Return Value

Compiler

at line 198
Compiler addExportedType(string $type)

Adds a type to export from the container.

Parameters

string $type

Return Value

Compiler

at line 212
string compile()

Compiles the container and returns the generated PHP code.

Return Value

string

at line 221
void processExtensions()

internal  
 

No description

Return Value

void

at line 311
string generateCode()

internal  
 

No description

Return Value

string

at line 330
void loadDefinitionsFromConfig(array $configList)

Loads list of service definitions from configuration.

Parameters

array $configList

Return Value

void

at line 341
protected PhpGenerator createPhpGenerator()

No description

Return Value

PhpGenerator

at line 348
Loader createLoader(array $params = [])

internal  
 

No description

Parameters

array $params

Return Value

Loader