class RequestMatcher (View source)

This class is a helper that can be used as a context for an Eel evaluation to match a request using the Eel Syntax. This is primarily used in the requestFilter of the Views.yaml configuration.

Properties

protected ActionRequest $request

Request that will be used for the matcher.

protected RequestMatcher $parentMatcher

This property is set if parentRequest or mainRequest is used. The main purpose is to properly track the weight of the parentRequest and mainRequest Matchers through the addWeight method

protected int $weight

The weight is a value that's added up through various matching functions in here. This is needed to have a way to determine, how specific a configuration Method is because that's how the configuration will be sorted.

Methods

__construct(ActionRequest $actionRequest = null, RequestMatcher $parentMatcher = null)

No description

bool
isPackage(string $package)

Check if the current Request's Package equals the argument

bool
isSubPackage(string $subPackage)

Check if the current Request's SubPackage equals the argument

bool
isController(string $controller)

Check if the current Request's Controller equals the argument

bool
isAction(string $action)

Check if the current Request's Action equals the argument

bool
isFormat(string $format)

Check if the current Request's Format equals the argument

bool
matchRequestProperty(string $propertyName, string $expectedValue, int $weight)

Compare a request propertyValue against an expected value and add the weight if it's true

getParentRequest()

Get a new RequestMatcher for the Request's ParentRequest

getMainRequest()

Get a new RequestMatcher for the Request's MainRequest

int
getWeight()

Return the current weight for this match

void
addWeight(int $weight)

Add a weight to the total

void
resetWeight()

Reset the match weight

Details

__construct(ActionRequest $actionRequest = null, RequestMatcher $parentMatcher = null)

No description

Parameters

ActionRequest $actionRequest
RequestMatcher $parentMatcher

bool isPackage(string $package)

Check if the current Request's Package equals the argument

Parameters

string $package

Return Value

bool

bool isSubPackage(string $subPackage)

Check if the current Request's SubPackage equals the argument

Parameters

string $subPackage

Return Value

bool

bool isController(string $controller)

Check if the current Request's Controller equals the argument

Parameters

string $controller

Return Value

bool

bool isAction(string $action)

Check if the current Request's Action equals the argument

Parameters

string $action

Return Value

bool

bool isFormat(string $format)

Check if the current Request's Format equals the argument

Parameters

string $format

Return Value

bool

protected bool matchRequestProperty(string $propertyName, string $expectedValue, int $weight)

Compare a request propertyValue against an expected value and add the weight if it's true

Parameters

string $propertyName
string $expectedValue
int $weight

Return Value

bool

RequestMatcher getParentRequest()

Get a new RequestMatcher for the Request's ParentRequest

Return Value

RequestMatcher

RequestMatcher getMainRequest()

Get a new RequestMatcher for the Request's MainRequest

Return Value

RequestMatcher

int getWeight()

Return the current weight for this match

Return Value

int

void addWeight(int $weight)

Add a weight to the total

Parameters

int $weight

Return Value

void

void resetWeight()

Reset the match weight

Return Value

void