Compiler
class Compiler (View source)
Builder for proxy classes which are used to implement Dependency Injection and Aspect-Oriented Programming
Constants
ORIGINAL_CLASSNAME_SUFFIX |
|
Properties
protected CompileTimeObjectManager | $objectManager | ||
protected PhpFrontend | $classesCache | ||
protected ReflectionService | $reflectionService | ||
protected array | $proxyClasses | ||
protected array | $excludedSubPackages | Hardcoded list of Flow sub packages which must be immune proxying for security, technical or conceptual reasons. |
|
protected int | $excludedSubPackagesLength | Length of the prefix that will be checked for exclusion of proxy building. |
|
protected array | $storedProxyClasses | The final map of proxy classes that end up in the cache. |
Methods
Compiler constructor.
Injects the cache for storing the renamed original classes and proxy classes
Returns a proxy class object for the specified original class.
Checks if the specified class still exists in the code cache. If that is the case, it means that obviously the proxy class doesn't have to be rebuilt because otherwise the cache would have been flushed by the file monitor or some other mechanism.
Compiles the configured proxy classes and methods as static PHP code and stores it in the proxy class code cache.
No description
Reads the specified class file, appends ORIGINAL_CLASSNAME_SUFFIX to its class name and stores the result in the proxy classes cache.
Removes the first opening php tag ("<?php") from the given $classCode if there is any
Render the source (string) form of an Annotation instance.
Render an array value as string for an annotation.
Details
__construct()
Compiler constructor.
void
injectObjectManager(CompileTimeObjectManager $objectManager)
No description
void
injectClassesCache(PhpFrontend $classesCache)
Injects the cache for storing the renamed original classes and proxy classes
void
injectReflectionService(ReflectionService $reflectionService)
No description
ProxyClass|bool
getProxyClass(string $fullClassName)
Returns a proxy class object for the specified original class.
If no such proxy class has been created yet by this renderer, this function will create one and register it for later use.
If the class is not proxable, false will be returned
bool
hasCacheEntryForClass(string $fullClassName)
Checks if the specified class still exists in the code cache. If that is the case, it means that obviously the proxy class doesn't have to be rebuilt because otherwise the cache would have been flushed by the file monitor or some other mechanism.
int
compile()
Compiles the configured proxy classes and methods as static PHP code and stores it in the proxy class code cache.
Also builds the static object container which acts as a registry for non-prototype objects during runtime.
string
getStoredProxyClassMap()
No description
protected void
cacheOriginalClassFileAndProxyCode(string $className, string $pathAndFilename, string $proxyClassCode)
Reads the specified class file, appends ORIGINAL_CLASSNAME_SUFFIX to its class name and stores the result in the proxy classes cache.
protected string
stripOpeningPhpTag(string $classCode)
Removes the first opening php tag ("<?php") from the given $classCode if there is any
static string
renderAnnotation(Annotation $annotation)
Render the source (string) form of an Annotation instance.
static protected string
renderOptionArrayValueAsString(array $optionValue)
Render an array value as string for an annotation.