class PointcutSettingFilter implements PointcutFilterInterface (View source)

A settings filter which fires on configuration setting set to true or equal to the given condition.

Example: setting(FooPackage.configuration.option = 'AOP is cool')

Constants

PATTERN_SPLITBYEQUALSIGN

PATTERN_MATCHVALUEINQUOTES

Properties

protected ConfigurationManager $configurationManager
protected string $settingComparisonExpression

The path leading to the setting to match with

protected mixed $actualSettingValue

The value of the specified setting

protected mixed $condition

The condition value to match against the configuration setting

protected bool $cachedResult

Methods

__construct(string $settingComparisonExpression)

The constructor - initializes the configuration filter with the path to a configuration option

void
injectConfigurationManager(ConfigurationManager $configurationManager)

Injects the configuration manager

bool
matches(string $className, string $methodName, string $methodDeclaringClassName, mixed $pointcutQueryIdentifier)

Checks if the specified configuration option is set to true or false, or if it matches the specified condition

bool
hasRuntimeEvaluationsDefinition()

Returns true if this filter holds runtime evaluations for a previously matched pointcut

array
getRuntimeEvaluationsDefinition()

Returns runtime evaluations for the pointcut.

void
parseConfigurationOptionPath(string $settingComparisonExpression)

Parses the given configuration path expression and sets $this->actualSettingValue and $this->condition accordingly

reduceTargetClassNames(ClassNameIndex $classNameIndex)

This method is used to optimize the matching process.

Details

__construct(string $settingComparisonExpression)

The constructor - initializes the configuration filter with the path to a configuration option

Parameters

string $settingComparisonExpression

Path (and optional condition) leading to the setting

void injectConfigurationManager(ConfigurationManager $configurationManager)

Injects the configuration manager

Parameters

ConfigurationManager $configurationManager

Return Value

void

bool matches(string $className, string $methodName, string $methodDeclaringClassName, mixed $pointcutQueryIdentifier)

Checks if the specified configuration option is set to true or false, or if it matches the specified condition

Parameters

string $className

Name of the class to check against

string $methodName

Name of the method to check against

string $methodDeclaringClassName

Name of the class the method was originally declared in

mixed $pointcutQueryIdentifier

Some identifier for this query - must at least differ from a previous identifier. Used for circular reference detection.

Return Value

bool

true if the class / method match, otherwise false

bool hasRuntimeEvaluationsDefinition()

Returns true if this filter holds runtime evaluations for a previously matched pointcut

Return Value

bool

true if this filter has runtime evaluations

array getRuntimeEvaluationsDefinition()

Returns runtime evaluations for the pointcut.

Return Value

array

Runtime evaluations

protected void parseConfigurationOptionPath(string $settingComparisonExpression)

Parses the given configuration path expression and sets $this->actualSettingValue and $this->condition accordingly

Parameters

string $settingComparisonExpression

The configuration expression (path + optional condition)

Return Value

void

Exceptions

InvalidPointcutExpressionException

ClassNameIndex reduceTargetClassNames(ClassNameIndex $classNameIndex)

This method is used to optimize the matching process.

Parameters

ClassNameIndex $classNameIndex

An index of class names

Return Value

ClassNameIndex

The filtered result, with pointcuts possibly covered by this filter