class Url implements Rule, Bypass

A rule to match a particular URL

Traits

Path aware trait for rules and bypasses

Methods

string
getPath()

Returns the path

from PathAware
$this
setPath(string $path)

Update the path

from PathAware
__construct(string $path, string[]|string|null $httpMethods = null, string[]|null $params = null)

Initialize the rule with the parameters

$this
addHttpMethods(string[] $methods)

Add HTTP methods to check against

string[]
getHttpMethods()

Returns HTTP methods to be checked

$this
setParams($params = null)

Set the GET parameters null to skip parameter check

bool
checkRequestForBypass(HTTPRequest $request)

Check the request for whether we can bypass the confirmation

null|Item
getRequestConfirmationItem(HTTPRequest $request)

Check the request by the rule and return a confirmation item

bool
checkRequest(HTTPRequest $request)

Match the request against the rules

Details

in PathAware at line 20
string getPath()

Returns the path

Return Value

string

in PathAware at line 32
$this setPath(string $path)

Update the path

Parameters

string $path

Return Value

$this

at line 36
__construct(string $path, string[]|string|null $httpMethods = null, string[]|null $params = null)

Initialize the rule with the parameters

Parameters

string $path url path to check for
string[]|string|null $httpMethods to match against
string[]|null $params a list of GET parameters

at line 56
$this addHttpMethods(string[] $methods)

Add HTTP methods to check against

Parameters

string[] $methods

Return Value

$this

at line 67
string[] getHttpMethods()

Returns HTTP methods to be checked

Return Value

string[]

at line 87
$this setParams($params = null)

Set the GET parameters null to skip parameter check

If an array of parameters provided, then URL should contain ALL of them and ONLY them to match. If the values in the list contain strings, those will be checked against parameter values accordingly. Null as a value in the array matches any parameter values.

Parameters

$params

Return Value

$this

at line 93
bool checkRequestForBypass(HTTPRequest $request)

Check the request for whether we can bypass the confirmation

Parameters

HTTPRequest $request

Return Value

bool True if we can bypass, False if the confirmation is required

at line 98
null|Item getRequestConfirmationItem(HTTPRequest $request)

Check the request by the rule and return a confirmation item

Parameters

HTTPRequest $request

Return Value

null|Item Confirmation item if necessary to protect the request or null otherwise

at line 117
bool checkRequest(HTTPRequest $request)

Match the request against the rules

Parameters

HTTPRequest $request

Return Value

bool