PHP Class Neos\Flow\ObjectManagement\Proxy\Compiler

Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$blacklistedSubPackages array Hardcoded list of Flow sub packages which must be immune proxying for security, technical or conceptual reasons.
$blacklistedSubPackagesLength integer See above.
$classesCache Neos\Cache\Frontend\PhpFrontend
$objectManager Neos\Flow\ObjectManagement\CompileTimeObjectManager
$proxyClasses array
$reflectionService Neos\Flow\Reflection\ReflectionService
$settings array
$storedProxyClasses array The final map of proxy classes that end up in the cache.

Public Methods

Method Description
__construct ( ) Compiler constructor.
compile ( ) : integer Compiles the configured proxy classes and methods as static PHP code and stores it in the proxy class code cache.
getProxyClass ( string $fullClassName ) : ProxyClass | boolean Returns a proxy class object for the specified original class.
getStoredProxyClassMap ( ) : string
hasCacheEntryForClass ( string $fullClassName ) : boolean 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.
injectClassesCache ( PhpFrontend $classesCache ) : void Injects the cache for storing the renamed original classes and proxy classes
injectObjectManager ( CompileTimeObjectManager $objectManager ) : void
injectReflectionService ( ReflectionService $reflectionService ) : void
injectSettings ( array $settings ) : void Injects the Flow settings
renderAnnotation ( Doctrine\Common\Annotations\Annotation $annotation ) : string Render the source (string) form of an Annotation instance.

Protected Methods

Method Description
cacheOriginalClassFileAndProxyCode ( string $className, string $pathAndFilename, string $proxyClassCode ) : void Reads the specified class file, appends ORIGINAL_CLASSNAME_SUFFIX to its class name and stores the result in the proxy classes cache.
renderOptionArrayValueAsString ( array $optionValue ) : string Render an array value as string for an annotation.
stripOpeningPhpTag ( string $classCode ) : string Removes the first opening php tag ("

Method Details

__construct() public method

Compiler constructor.
public __construct ( )

cacheOriginalClassFileAndProxyCode() protected method

Reads the specified class file, appends ORIGINAL_CLASSNAME_SUFFIX to its class name and stores the result in the proxy classes cache.
protected cacheOriginalClassFileAndProxyCode ( string $className, string $pathAndFilename, string $proxyClassCode ) : void
$className string Short class name of the class to copy
$pathAndFilename string Full path and filename of the original class file
$proxyClassCode string The code that makes up the proxy class
return void

compile() public method

Also builds the static object container which acts as a registry for non-prototype objects during runtime.
public compile ( ) : integer
return integer Number of classes which have been compiled

getProxyClass() public method

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
public getProxyClass ( string $fullClassName ) : ProxyClass | boolean
$fullClassName string Name of the original class
return ProxyClass | boolean

getStoredProxyClassMap() public method

public getStoredProxyClassMap ( ) : string
return string

hasCacheEntryForClass() public method

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.
public hasCacheEntryForClass ( string $fullClassName ) : boolean
$fullClassName string Name of the original class
return boolean TRUE if a cache entry exists

injectClassesCache() public method

Injects the cache for storing the renamed original classes and proxy classes
public injectClassesCache ( PhpFrontend $classesCache ) : void
$classesCache Neos\Cache\Frontend\PhpFrontend
return void

injectObjectManager() public method

public injectObjectManager ( CompileTimeObjectManager $objectManager ) : void
$objectManager Neos\Flow\ObjectManagement\CompileTimeObjectManager
return void

injectReflectionService() public method

public injectReflectionService ( ReflectionService $reflectionService ) : void
$reflectionService Neos\Flow\Reflection\ReflectionService
return void

injectSettings() public method

Injects the Flow settings
public injectSettings ( array $settings ) : void
$settings array The settings
return void

renderAnnotation() public static method

Render the source (string) form of an Annotation instance.
public static renderAnnotation ( Doctrine\Common\Annotations\Annotation $annotation ) : string
$annotation Doctrine\Common\Annotations\Annotation
return string

renderOptionArrayValueAsString() protected static method

Render an array value as string for an annotation.
protected static renderOptionArrayValueAsString ( array $optionValue ) : string
$optionValue array
return string

stripOpeningPhpTag() protected method

Removes the first opening php tag ("
protected stripOpeningPhpTag ( string $classCode ) : string
$classCode string
return string the original class code without opening php tag

Property Details

$blacklistedSubPackages protected property

Hardcoded list of Flow sub packages which must be immune proxying for security, technical or conceptual reasons.
protected array $blacklistedSubPackages
return array

$blacklistedSubPackagesLength protected property

See above.
protected int $blacklistedSubPackagesLength
return integer

$classesCache protected property

protected PhpFrontend,Neos\Cache\Frontend $classesCache
return Neos\Cache\Frontend\PhpFrontend

$objectManager protected property

protected CompileTimeObjectManager,Neos\Flow\ObjectManagement $objectManager
return Neos\Flow\ObjectManagement\CompileTimeObjectManager

$proxyClasses protected property

protected array $proxyClasses
return array

$reflectionService protected property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
return Neos\Flow\Reflection\ReflectionService

$settings protected property

protected array $settings
return array

$storedProxyClasses protected property

The final map of proxy classes that end up in the cache.
protected array $storedProxyClasses
return array