ConfigurationBuilder
class ConfigurationBuilder (View source)
Object Configuration Builder which can build object configuration objects from information collected by reflection combined with arrays of configuration options as defined in an Objects.yaml file.
Properties
protected ReflectionService | $reflectionService | ||
protected LoggerInterface | $logger | ||
protected array | $excludeClassesFromConstructorAutowiring | An array of object names for which constructor injection autowiring should be disabled. |
Methods
Injects the (system) logger based on PSR-3.
No description
Traverses through the given class and interface names and builds a base object configuration for all of them. Then parses the provided extra configuration and merges the result into the overall configuration. Finally autowires dependencies of arguments and properties which can be resolved automatically.
Builds a raw configuration array by parsing possible scope and autowiring annotations from the given class or interface.
Builds an object configuration object from a generic configuration container.
Parses the value of the option "scope"
Parses the value of the option "autowiring"
Parses the configuration for properties of type OBJECT
Parses the configuration for arguments of type OBJECT
Creates a "virtual object configuration" for factory arguments, turning:
If mandatory constructor arguments have not been defined yet, this function tries to autowire them if possible.
This function tries to find yet unmatched dependencies which need to be injected via "inject*" setter methods.
Details
void
injectReflectionService(ReflectionService $reflectionService)
No description
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
void
injectExcludeClassesFromConstructorAutowiring(array $excludeClassesFromConstructorAutowiring)
No description
Configuration[]
buildObjectConfigurations(array $availableClassAndInterfaceNamesByPackage, array $rawObjectConfigurationsByPackages)
Traverses through the given class and interface names and builds a base object configuration for all of them. Then parses the provided extra configuration and merges the result into the overall configuration. Finally autowires dependencies of arguments and properties which can be resolved automatically.
protected array
enhanceRawConfigurationWithAnnotationOptions(string $className, array $rawObjectConfiguration)
Builds a raw configuration array by parsing possible scope and autowiring annotations from the given class or interface.
protected Configuration
parseConfigurationArray(string $objectName, array $rawConfigurationOptions, string $configurationSourceHint = '', Configuration $existingObjectConfiguration = null)
Builds an object configuration object from a generic configuration container.
protected int
parseScope(string $value)
Parses the value of the option "scope"
static protected int
parseAutowiring(mixed $value)
Parses the value of the option "autowiring"
protected ConfigurationProperty
parsePropertyOfTypeObject(string $propertyName, mixed $objectNameOrConfiguration, Configuration $parentObjectConfiguration)
Parses the configuration for properties of type OBJECT
protected ConfigurationArgument
parseArgumentOfTypeObject(string $argumentName, mixed $objectNameOrConfiguration, string $configurationSourceHint)
Parses the configuration for arguments of type OBJECT
protected void
wireFactoryArguments(array $objectConfigurations)
Creates a "virtual object configuration" for factory arguments, turning:
'Some\Class\Name': factoryObjectName: 'Some\Factory\Class' arguments: 1: object: factoryObjectName: 'Some\Other\Factory\Class'
into:
'Some\Class\Name': factoryObjectName: 'Some\Factory\Class' arguments: 1: object: 'Some\Class\Name:argument:1'
'Some\Class\Name:argument:1': factoryObjectName: 'Some\Other\Factory\Class'
protected void
autowireArguments(array $objectConfigurations)
If mandatory constructor arguments have not been defined yet, this function tries to autowire them if possible.
protected void
autowireProperties(array $objectConfigurations)
This function tries to find yet unmatched dependencies which need to be injected via "inject*" setter methods.