class MethodTargetExpressionParser extends PointcutExpressionParser (View source)

A specialized pointcut expression parser tailored to policy expressions

Constants

PATTERN_SPLITBYOPERATOR

PATTERN_MATCHPOINTCUTDESIGNATOR

PATTERN_MATCHVISIBILITYMODIFIER

PATTERN_MATCHRUNTIMEEVALUATIONSDEFINITION

PATTERN_MATCHRUNTIMEEVALUATIONSVALUELIST

PATTERN_MATCHMETHODNAMEANDARGUMENTS

Properties

protected ProxyClassBuilder $proxyClassBuilder from  PointcutExpressionParser
protected ReflectionService $reflectionService from  PointcutExpressionParser
protected ObjectManagerInterface $objectManager from  PointcutExpressionParser
protected string $sourceHint from  PointcutExpressionParser

Methods

void
injectProxyClassBuilder(ProxyClassBuilder $proxyClassBuilder)

No description

void
injectReflectionService(ReflectionService $reflectionService)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

parse(string $pointcutExpression, string $sourceHint)

Parses a string pointcut expression and returns the pointcut objects accordingly

void
parseDesignatorClassAnnotatedWith(string $operator, string $annotationPattern, PointcutFilterComposite $pointcutFilterComposite)

Takes a class annotation filter pattern and adds a so configured class annotation filter to the filter composite object.

void
parseDesignatorClass(string $operator, string $classPattern, PointcutFilterComposite $pointcutFilterComposite)

Takes a class filter pattern and adds a so configured class filter to the filter composite object.

void
parseDesignatorMethodAnnotatedWith(string $operator, string $annotationPattern, PointcutFilterComposite $pointcutFilterComposite)

Takes a method annotation filter pattern and adds a so configured method annotation filter to the filter composite object.

void
parseAnnotationPattern(string $annotationPattern, array $annotationPropertyConstraints)

Parse an annotation pattern and adjust $annotationPattern and $annotationPropertyConstraints as needed.

void
parseDesignatorMethod(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite)

Splits the parameters of the pointcut designator "method" into a class and a method part and adds the appropriately configured filters to the filter composite object.

void
parseDesignatorWithin(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite)

Adds a class type filter to the pointcut filter composite

void
parseDesignatorPointcut(string $operator, string $pointcutExpression, PointcutFilterComposite $pointcutFilterComposite, array $trace = [])

Throws an exception, as recursive privilege targets are not allowed.

void
parseDesignatorFilter(string $operator, string $filterObjectName, PointcutFilterComposite $pointcutFilterComposite)

Adds a custom filter to the pointcut filter composite

void
parseDesignatorSetting(string $operator, string $configurationPath, PointcutFilterComposite $pointcutFilterComposite)

Adds a setting filter to the pointcut filter composite

void
parseRuntimeEvaluations(string $operator, string $runtimeEvaluations, PointcutFilterComposite $pointcutFilterComposite)

Adds runtime evaluations to the pointcut filter composite

string
getSubstringBetweenParentheses(string $string)

Returns the substring of $string which is enclosed by parentheses of the first level.

string|null
getVisibilityFromSignaturePattern(string $signaturePattern)

Parses the signature pattern and returns the visibility modifier if any. If a modifier was found, it will be removed from the $signaturePattern.

array
getArgumentConstraintsFromMethodArgumentsPattern(string $methodArgumentsPattern)

Parses the method arguments pattern and returns the corresponding constraints array

array
getRuntimeEvaluationConditionsFromEvaluateString(string $evaluateString)

Parses the evaluate string for runtime evaluations and returns the corresponding conditions array

Details

void injectProxyClassBuilder(ProxyClassBuilder $proxyClassBuilder)

No description

Parameters

ProxyClassBuilder $proxyClassBuilder

Return Value

void

void injectReflectionService(ReflectionService $reflectionService)

No description

Parameters

ReflectionService $reflectionService

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

PointcutFilterComposite parse(string $pointcutExpression, string $sourceHint)

Parses a string pointcut expression and returns the pointcut objects accordingly

Parameters

string $pointcutExpression

The expression defining the pointcut

string $sourceHint

A message giving a hint on where the expression was defined. This is used in error messages.

Return Value

PointcutFilterComposite

A composite of class-filters, method-filters and pointcuts

Exceptions

InvalidPointcutExpressionException
Exception

protected void parseDesignatorClassAnnotatedWith(string $operator, string $annotationPattern, PointcutFilterComposite $pointcutFilterComposite)

Takes a class annotation filter pattern and adds a so configured class annotation filter to the filter composite object.

Parameters

string $operator

The operator

string $annotationPattern

The pattern expression as configuration for the class annotation filter

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the class annotation filter) will be added to this composite object.

Return Value

void

protected void parseDesignatorClass(string $operator, string $classPattern, PointcutFilterComposite $pointcutFilterComposite)

Takes a class filter pattern and adds a so configured class filter to the filter composite object.

Parameters

string $operator

The operator

string $classPattern

The pattern expression as configuration for the class filter

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the class filter) will be added to this composite object.

Return Value

void

protected void parseDesignatorMethodAnnotatedWith(string $operator, string $annotationPattern, PointcutFilterComposite $pointcutFilterComposite)

Takes a method annotation filter pattern and adds a so configured method annotation filter to the filter composite object.

Parameters

string $operator

The operator

string $annotationPattern

The pattern expression as configuration for the method annotation filter

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the method annotation filter) will be added to this composite object.

Return Value

void

protected void parseAnnotationPattern(string $annotationPattern, array $annotationPropertyConstraints)

Parse an annotation pattern and adjust $annotationPattern and $annotationPropertyConstraints as needed.

Parameters

string $annotationPattern
array $annotationPropertyConstraints

Return Value

void

protected void parseDesignatorMethod(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite)

Splits the parameters of the pointcut designator "method" into a class and a method part and adds the appropriately configured filters to the filter composite object.

Parameters

string $operator

The operator

string $signaturePattern

The pattern expression defining the class and method - the "signature"

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the class and method filter) will be added to this composite object.

Return Value

void

Exceptions

InvalidPointcutExpressionException

protected void parseDesignatorWithin(string $operator, string $signaturePattern, PointcutFilterComposite $pointcutFilterComposite)

Adds a class type filter to the pointcut filter composite

Parameters

string $operator
string $signaturePattern

The pattern expression defining the class type

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the class type filter) will be added to this composite object.

Return Value

void

protected void parseDesignatorPointcut(string $operator, string $pointcutExpression, PointcutFilterComposite $pointcutFilterComposite, array $trace = [])

Throws an exception, as recursive privilege targets are not allowed.

Parameters

string $operator

The operator

string $pointcutExpression

The pointcut expression (value of the designator)

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the pointcut filter) will be added to this composite object.

array $trace

Return Value

void

Exceptions

InvalidPointcutExpressionException

protected void parseDesignatorFilter(string $operator, string $filterObjectName, PointcutFilterComposite $pointcutFilterComposite)

Adds a custom filter to the pointcut filter composite

Parameters

string $operator

The operator

string $filterObjectName

Object Name of the custom filter (value of the designator)

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object.

Return Value

void

Exceptions

InvalidPointcutExpressionException

protected void parseDesignatorSetting(string $operator, string $configurationPath, PointcutFilterComposite $pointcutFilterComposite)

Adds a setting filter to the pointcut filter composite

Parameters

string $operator

The operator

string $configurationPath

The path to the settings option, that should be used

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object.

Return Value

void

protected void parseRuntimeEvaluations(string $operator, string $runtimeEvaluations, PointcutFilterComposite $pointcutFilterComposite)

Adds runtime evaluations to the pointcut filter composite

Parameters

string $operator

The operator

string $runtimeEvaluations

The runtime evaluations string

PointcutFilterComposite $pointcutFilterComposite

An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object.

Return Value

void

protected string getSubstringBetweenParentheses(string $string)

Returns the substring of $string which is enclosed by parentheses of the first level.

Parameters

string $string

The string to parse

Return Value

string

The inner part between the first level of parentheses

Exceptions

InvalidPointcutExpressionException

protected string|null getVisibilityFromSignaturePattern(string $signaturePattern)

Parses the signature pattern and returns the visibility modifier if any. If a modifier was found, it will be removed from the $signaturePattern.

Parameters

string $signaturePattern

The regular expression for matching the method() signature

Return Value

string|null

Visibility modifier or NULL of none was found

Exceptions

InvalidPointcutExpressionException

protected array getArgumentConstraintsFromMethodArgumentsPattern(string $methodArgumentsPattern)

Parses the method arguments pattern and returns the corresponding constraints array

Parameters

string $methodArgumentsPattern

The arguments pattern defined in the pointcut expression

Return Value

array

The corresponding constraints array

protected array getRuntimeEvaluationConditionsFromEvaluateString(string $evaluateString)

Parses the evaluate string for runtime evaluations and returns the corresponding conditions array

Parameters

string $evaluateString

The evaluate string defined in the pointcut expression

Return Value

array

The corresponding constraints array