ProxyClassBuilder
class ProxyClassBuilder (View source)
A Proxy Class Builder which integrates Dependency Injection.
Properties
protected ReflectionService | $reflectionService | ||
protected Compiler | $compiler | ||
protected LoggerInterface | $logger | ||
protected ConfigurationManager | $configurationManager | ||
protected CompileTimeObjectManager | $objectManager | ||
protected Configuration[] | $objectConfigurations |
Methods
Injects the (system) logger based on PSR-3.
Analyzes the Object Configuration provided by the compiler and builds the necessary PHP code for the proxy classes to realize dependency injection.
Renders additional code which registers the instance of the proxy class at the Object Manager before constructor injection is executed. Used in constructors and wakeup methods.
Renders code to create identifier/type information from related entities in an object.
Renders additional code for the __construct() method of the Proxy Class which realizes constructor injection.
Builds the code necessary to inject setter based dependencies.
Builds code which injects an object which was specified by its object configuration
Builds code which injects an object which was specified by its object name
Builds code which assigns the value stored in the specified configuration into the given class property.
Builds code which injects a DependencyProxy instead of the actual dependency
Builds a code snippet which tries to inject the specified property first through calling the related inject() method and then the set() method. If neither exists and the property doesn't exist either, an empty array is returned.
Builds code which calls the lifecycle initialization method, if any.
Builds code which registers the lifecycle shutdown method, if any.
FIXME: Not yet completely refactored to new proxy mechanism
No description
Compile the result of methods marked with CompileStatic into the proxy class
Details
void
injectReflectionService(ReflectionService $reflectionService)
No description
void
injectCompiler(Compiler $compiler)
No description
void
injectConfigurationManager(ConfigurationManager $configurationManager)
No description
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
void
injectObjectManager(CompileTimeObjectManager $objectManager)
No description
void
build()
Analyzes the Object Configuration provided by the compiler and builds the necessary PHP code for the proxy classes to realize dependency injection.
protected string
buildSetInstanceCode(Configuration $objectConfiguration)
Renders additional code which registers the instance of the proxy class at the Object Manager before constructor injection is executed. Used in constructors and wakeup methods.
This also makes sure that object creation does not end in an endless loop due to bi-directional dependencies.
protected string
buildSerializeRelatedEntitiesCode(Configuration $objectConfiguration)
Renders code to create identifier/type information from related entities in an object.
Used in sleep methods.
protected string
buildConstructorInjectionCode(Configuration $objectConfiguration)
Renders additional code for the __construct() method of the Proxy Class which realizes constructor injection.
protected string
buildPropertyInjectionCode(Configuration $objectConfiguration)
Builds the code necessary to inject setter based dependencies.
protected array
buildPropertyInjectionCodeByConfiguration(Configuration $objectConfiguration, string $propertyName, Configuration $propertyConfiguration)
Builds code which injects an object which was specified by its object configuration
array
buildPropertyInjectionCodeByString(Configuration $objectConfiguration, ConfigurationProperty $propertyConfiguration, string $propertyName, string $propertyObjectName)
Builds code which injects an object which was specified by its object name
array
buildPropertyInjectionCodeByConfigurationTypeAndPath(Configuration $objectConfiguration, string $propertyName, string $configurationType, string $configurationPath = null)
Builds code which assigns the value stored in the specified configuration into the given class property.
protected array
buildLazyPropertyInjectionCode(string $propertyObjectName, string $propertyClassName, string $propertyName, string $preparedSetterArgument)
Builds code which injects a DependencyProxy instead of the actual dependency
protected array
buildSetterInjectionCode(string $className, string $propertyName, string $preparedSetterArgument)
Builds a code snippet which tries to inject the specified property first through calling the related inject() method and then the set() method. If neither exists and the property doesn't exist either, an empty array is returned.
If neither inject() nor set() exists, but the property does exist, NULL is returned
protected string
buildLifecycleInitializationCode(Configuration $objectConfiguration, int $cause)
Builds code which calls the lifecycle initialization method, if any.
protected string
buildLifecycleShutdownCode(Configuration $objectConfiguration, int $cause)
Builds code which registers the lifecycle shutdown method, if any.
protected string
buildMethodParametersCode(array $argumentConfigurations)
FIXME: Not yet completely refactored to new proxy mechanism
protected string
buildCustomFactoryCall(string $customFactoryObjectName, string $customFactoryMethodName, array $arguments)
No description
protected void
compileStaticMethods(string $className, ProxyClass $proxyClass)
Compile the result of methods marked with CompileStatic into the proxy class