PHP Класс Neos\Flow\Aop\Builder\ProxyClassBuilder

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$aspectContainers array A registry of all known aspects
$blacklistedSubPackages array Hardcoded list of Flow sub packages (first 15 characters) which must be immune to AOP proxying for security, technical or conceptual reasons.
$compiler Neos\Flow\ObjectManagement\Proxy\Compiler
$methodInterceptorBuilders array
$objectConfigurationCache Neos\Cache\Frontend\VariableFrontend
$objectManager Neos\Flow\ObjectManagement\CompileTimeObjectManager
$pointcutExpressionParser Neos\Flow\Aop\Pointcut\PointcutExpressionParser An instance of the pointcut expression parser
$proxyClassBuilder ProxyClassBuilder
$reflectionService Neos\Flow\Reflection\ReflectionService
$settings array The Flow settings
$systemLogger Neos\Flow\Log\SystemLoggerInterface

Открытые методы

Метод Описание
build ( ) : void Builds proxy class code which weaves advices into the respective target classes.
buildProxyClass ( string $targetClassName, array &$aspectContainers ) : boolean Builds methods for a single AOP proxy class for the specified class.
findPointcut ( string $aspectClassName, string $pointcutMethodName ) : mixed Traverses the aspect containers to find a pointcut from the aspect class name and pointcut method name
injectAdvicedConstructorInterceptorBuilder ( AdvicedConstructorInterceptorBuilder $builder ) : void Injects the Adviced Constructor Interceptor Builder
injectAdvicedMethodInterceptorBuilder ( AdvicedMethodInterceptorBuilder $builder ) : void Injects the Adviced Method Interceptor Builder
injectCompiler ( Compiler $compiler ) : void
injectObjectConfigurationCache ( Neos\Cache\Frontend\VariableFrontend $objectConfigurationCache ) : void Injects the cache for storing information about objects
injectObjectManager ( CompileTimeObjectManager $objectManager ) : void
injectPointcutExpressionParser ( PointcutExpressionParser $pointcutExpressionParser ) : void Injects an instance of the pointcut expression parser
injectReflectionService ( ReflectionService $reflectionService ) : void Injects the reflection service
injectSettings ( array $settings ) : void Injects the Flow settings
injectSystemLogger ( Neos\Flow\Log\SystemLoggerInterface $systemLogger ) : void

Защищенные методы

Метод Описание
addAdvicedMethodsToInterceptedMethods ( array &$interceptedMethods, array $methods, string $targetClassName, array &$aspectContainers ) : void Traverses all aspect containers, their aspects and their advisors and adds the methods and their advices to the (usually empty) array of intercepted methods.
addBuildMethodsAndAdvicesCodeToClass ( string $className, ClassNameIndex $treatedSubClasses ) : ClassNameIndex Adds code to build the methods and advices array in case the parent class has some.
addIntroducedMethodsToInterceptedMethods ( array &$interceptedMethods, array $methodsFromIntroducedInterfaces ) : void Traverses all methods which were introduced by interfaces and adds them to the intercepted methods array if they didn't exist already.
buildAspectContainer ( string $aspectClassName ) : mixed Creates and returns an aspect from the annotations found in a class which is tagged as an aspect. The object acting as an advice will already be fetched (and therefore instantiated if necessary).
buildAspectContainers ( array &$classNames ) : array Checks the annotations of the specified classes for aspect tags and creates an aspect with advisors accordingly.
buildMethodsAndAdvicesArrayCode ( array $methodsAndGroupedAdvices ) : string Creates code for an array of target methods and their advices.
buildMethodsInterceptorCode ( string $targetClassName, array $interceptedMethods ) : void Traverses all intercepted methods and their advices and builds PHP code to intercept methods if necessary.
getInterfaceNamesFromIntroductions ( array $interfaceIntroductions ) : array Returns an array of interface names introduced by the given introductions
getIntroducedMethodsFromInterfaceIntroductions ( array $interfaceIntroductions ) : array Returns all methods declared by the introduced interfaces
getMatchingInterfaceIntroductions ( array &$aspectContainers, string $targetClassName ) : array Traverses all aspect containers and returns an array of interface introductions which match the target class.
getMatchingPropertyIntroductions ( array &$aspectContainers, string $targetClassName ) : array | PropertyIntroduction[] Traverses all aspect containers and returns an array of property introductions which match the target class.
getMatchingTraitNamesFromIntroductions ( array &$aspectContainers, string $targetClassName ) : array Traverses all aspect containers and returns an array of trait introductions which match the target class.
getMethodsFromTargetClass ( string $targetClassName ) : array Returns the methods of the target class.
getProxyableClasses ( array $classNamesByPackage ) : array Determines which of the given classes are potentially proxyable and returns their names in an array.
proxySubClassesOfClassToEnsureAdvices ( string $className, ClassNameIndex $targetClassNameCandidates, ClassNameIndex $treatedSubClasses ) : ClassNameIndex Makes sure that any sub classes of an adviced class also build the advices array on construction.
renderSourceHint ( string $aspectClassName, string $methodName, string $tagName ) : string Renders a short message which gives a hint on where the currently parsed pointcut expression was defined.

Описание методов

addAdvicedMethodsToInterceptedMethods() защищенный Метод

Traverses all aspect containers, their aspects and their advisors and adds the methods and their advices to the (usually empty) array of intercepted methods.
protected addAdvicedMethodsToInterceptedMethods ( array &$interceptedMethods, array $methods, string $targetClassName, array &$aspectContainers ) : void
$interceptedMethods array
$methods array An array of class and method names which are matched against the pointcut (class name = name of the class or interface the method was declared)
$targetClassName string Name of the class the pointcut should match with
$aspectContainers array
Результат void

addBuildMethodsAndAdvicesCodeToClass() защищенный Метод

Adds code to build the methods and advices array in case the parent class has some.
protected addBuildMethodsAndAdvicesCodeToClass ( string $className, ClassNameIndex $treatedSubClasses ) : ClassNameIndex
$className string
$treatedSubClasses ClassNameIndex
Результат ClassNameIndex

addIntroducedMethodsToInterceptedMethods() защищенный Метод

Traverses all methods which were introduced by interfaces and adds them to the intercepted methods array if they didn't exist already.
protected addIntroducedMethodsToInterceptedMethods ( array &$interceptedMethods, array $methodsFromIntroducedInterfaces ) : void
$interceptedMethods array
$methodsFromIntroducedInterfaces array An array of class and method names from introduced interfaces
Результат void

build() публичный Метод

The object configurations provided by the Compiler are searched for possible aspect annotations. If an aspect class is found, the pointcut expressions are parsed and a new aspect with one or more advisors is added to the aspect registry of the AOP framework. Finally all advices are woven into their target classes by generating proxy classes. In general, the command neos.flow:core:compile is responsible for compilation and calls this method to do so. In order to distinguish between an emerged / changed possible target class and a class which has been matched previously but just didn't have to be proxied, the latter are kept track of by an "unproxiedClass-*" cache entry.
public build ( ) : void
Результат void

buildAspectContainer() защищенный Метод

Creates and returns an aspect from the annotations found in a class which is tagged as an aspect. The object acting as an advice will already be fetched (and therefore instantiated if necessary).
protected buildAspectContainer ( string $aspectClassName ) : mixed
$aspectClassName string Name of the class which forms the aspect, contains advices etc.
Результат mixed The aspect container containing one or more advisors or FALSE if no container could be built

buildAspectContainers() защищенный Метод

Checks the annotations of the specified classes for aspect tags and creates an aspect with advisors accordingly.
protected buildAspectContainers ( array &$classNames ) : array
$classNames array
Результат array An array of Aop\AspectContainer for all aspects which were found.

buildMethodsAndAdvicesArrayCode() защищенный Метод

Example: $this->Flow_Aop_Proxy_targetMethodsAndGroupedAdvices = array( 'getSomeProperty' => array( \Neos\Flow\Aop\Advice\AroundAdvice::class => array( new \Neos\Flow\Aop\Advice\AroundAdvice(\Neos\Foo\SomeAspect::class, 'aroundAdvice', \Neos\Flow\Core\Bootstrap::$staticObjectManager, function() { ... }), ), ), );
См. также: buildProxyClass()
protected buildMethodsAndAdvicesArrayCode ( array $methodsAndGroupedAdvices ) : string
$methodsAndGroupedAdvices array An array of method names and grouped advice objects
Результат string PHP code for the content of an array of target method names and advice objects

buildMethodsInterceptorCode() защищенный Метод

The generated code is added directly to the proxy class by calling the respective methods of the Compiler API.
protected buildMethodsInterceptorCode ( string $targetClassName, array $interceptedMethods ) : void
$targetClassName string The target class the pointcut should match with
$interceptedMethods array An array of method names which need to be intercepted
Результат void

buildProxyClass() публичный Метод

Builds methods for a single AOP proxy class for the specified class.
public buildProxyClass ( string $targetClassName, array &$aspectContainers ) : boolean
$targetClassName string Name of the class to create a proxy class file for
$aspectContainers array
Результат boolean TRUE if the proxy class could be built, FALSE otherwise.

findPointcut() публичный Метод

Traverses the aspect containers to find a pointcut from the aspect class name and pointcut method name
public findPointcut ( string $aspectClassName, string $pointcutMethodName ) : mixed
$aspectClassName string Name of the aspect class where the pointcut has been declared
$pointcutMethodName string Method name of the pointcut
Результат mixed The Aop\Pointcut\Pointcut or FALSE if none was found

getInterfaceNamesFromIntroductions() защищенный Метод

Returns an array of interface names introduced by the given introductions
protected getInterfaceNamesFromIntroductions ( array $interfaceIntroductions ) : array
$interfaceIntroductions array An array of interface introductions
Результат array Array of interface names

getIntroducedMethodsFromInterfaceIntroductions() защищенный Метод

Returns all methods declared by the introduced interfaces
protected getIntroducedMethodsFromInterfaceIntroductions ( array $interfaceIntroductions ) : array
$interfaceIntroductions array An array of Aop\InterfaceIntroduction
Результат array An array of method information (interface, method name)

getMatchingInterfaceIntroductions() защищенный Метод

Traverses all aspect containers and returns an array of interface introductions which match the target class.
protected getMatchingInterfaceIntroductions ( array &$aspectContainers, string $targetClassName ) : array
$aspectContainers array
$targetClassName string Name of the class the pointcut should match with
Результат array array of interface names

getMatchingPropertyIntroductions() защищенный Метод

Traverses all aspect containers and returns an array of property introductions which match the target class.
protected getMatchingPropertyIntroductions ( array &$aspectContainers, string $targetClassName ) : array | PropertyIntroduction[]
$aspectContainers array
$targetClassName string Name of the class the pointcut should match with
Результат array | Neos\Flow\Aop\PropertyIntroduction[] array of property introductions

getMatchingTraitNamesFromIntroductions() защищенный Метод

Traverses all aspect containers and returns an array of trait introductions which match the target class.
protected getMatchingTraitNamesFromIntroductions ( array &$aspectContainers, string $targetClassName ) : array
$aspectContainers array
$targetClassName string Name of the class the pointcut should match with
Результат array array of trait names

getMethodsFromTargetClass() защищенный Метод

Returns the methods of the target class.
protected getMethodsFromTargetClass ( string $targetClassName ) : array
$targetClassName string Name of the target class
Результат array Method information with declaring class and method name pairs

getProxyableClasses() защищенный Метод

Determines which of the given classes are potentially proxyable and returns their names in an array.
protected getProxyableClasses ( array $classNamesByPackage ) : array
$classNamesByPackage array Names of the classes to check
Результат array Names of classes which can be proxied

injectAdvicedConstructorInterceptorBuilder() публичный Метод

Injects the Adviced Constructor Interceptor Builder
public injectAdvicedConstructorInterceptorBuilder ( AdvicedConstructorInterceptorBuilder $builder ) : void
$builder AdvicedConstructorInterceptorBuilder
Результат void

injectAdvicedMethodInterceptorBuilder() публичный Метод

Injects the Adviced Method Interceptor Builder
public injectAdvicedMethodInterceptorBuilder ( AdvicedMethodInterceptorBuilder $builder ) : void
$builder AdvicedMethodInterceptorBuilder
Результат void

injectCompiler() публичный Метод

public injectCompiler ( Compiler $compiler ) : void
$compiler Neos\Flow\ObjectManagement\Proxy\Compiler
Результат void

injectObjectConfigurationCache() публичный Метод

Injects the cache for storing information about objects
public injectObjectConfigurationCache ( Neos\Cache\Frontend\VariableFrontend $objectConfigurationCache ) : void
$objectConfigurationCache Neos\Cache\Frontend\VariableFrontend
Результат void

injectObjectManager() публичный Метод

public injectObjectManager ( CompileTimeObjectManager $objectManager ) : void
$objectManager Neos\Flow\ObjectManagement\CompileTimeObjectManager
Результат void

injectPointcutExpressionParser() публичный Метод

Injects an instance of the pointcut expression parser
public injectPointcutExpressionParser ( PointcutExpressionParser $pointcutExpressionParser ) : void
$pointcutExpressionParser Neos\Flow\Aop\Pointcut\PointcutExpressionParser
Результат void

injectReflectionService() публичный Метод

Injects the reflection service
public injectReflectionService ( ReflectionService $reflectionService ) : void
$reflectionService Neos\Flow\Reflection\ReflectionService
Результат void

injectSettings() публичный Метод

Injects the Flow settings
public injectSettings ( array $settings ) : void
$settings array The settings
Результат void

injectSystemLogger() публичный Метод

public injectSystemLogger ( Neos\Flow\Log\SystemLoggerInterface $systemLogger ) : void
$systemLogger Neos\Flow\Log\SystemLoggerInterface
Результат void

proxySubClassesOfClassToEnsureAdvices() защищенный Метод

Makes sure that any sub classes of an adviced class also build the advices array on construction.
protected proxySubClassesOfClassToEnsureAdvices ( string $className, ClassNameIndex $targetClassNameCandidates, ClassNameIndex $treatedSubClasses ) : ClassNameIndex
$className string The adviced class name
$targetClassNameCandidates ClassNameIndex target class names for advices
$treatedSubClasses ClassNameIndex Already treated (sub) classes to avoid duplication
Результат ClassNameIndex The new collection of already treated classes

renderSourceHint() защищенный Метод

Renders a short message which gives a hint on where the currently parsed pointcut expression was defined.
protected renderSourceHint ( string $aspectClassName, string $methodName, string $tagName ) : string
$aspectClassName string
$methodName string
$tagName string
Результат string

Описание свойств

$aspectContainers защищенное свойство

A registry of all known aspects
protected array $aspectContainers
Результат array

$blacklistedSubPackages защищенное свойство

Hardcoded list of Flow sub packages (first 15 characters) which must be immune to AOP proxying for security, technical or conceptual reasons.
protected array $blacklistedSubPackages
Результат array

$compiler защищенное свойство

protected Compiler,Neos\Flow\ObjectManagement\Proxy $compiler
Результат Neos\Flow\ObjectManagement\Proxy\Compiler

$methodInterceptorBuilders защищенное свойство

protected array $methodInterceptorBuilders
Результат array

$objectConfigurationCache защищенное свойство

protected VariableFrontend,Neos\Cache\Frontend $objectConfigurationCache
Результат Neos\Cache\Frontend\VariableFrontend

$objectManager защищенное свойство

protected CompileTimeObjectManager,Neos\Flow\ObjectManagement $objectManager
Результат Neos\Flow\ObjectManagement\CompileTimeObjectManager

$pointcutExpressionParser защищенное свойство

An instance of the pointcut expression parser
protected PointcutExpressionParser,Neos\Flow\Aop\Pointcut $pointcutExpressionParser
Результат Neos\Flow\Aop\Pointcut\PointcutExpressionParser

$proxyClassBuilder защищенное свойство

protected ProxyClassBuilder,Neos\Flow\Aop\Builder $proxyClassBuilder
Результат ProxyClassBuilder

$reflectionService защищенное свойство

protected ReflectionService,Neos\Flow\Reflection $reflectionService
Результат Neos\Flow\Reflection\ReflectionService

$settings защищенное свойство

The Flow settings
protected array $settings
Результат array

$systemLogger защищенное свойство

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
Результат Neos\Flow\Log\SystemLoggerInterface