class UrlPathStartswith implements Rule, Bypass (View source)

A rule to match beginning of URL

Traits

Path aware trait for rules and bypasses

Methods

public
string
getPath()

Returns the path

public
$this
setPath(string $path)

Update the path

protected
string
normalisePath(string $path)

Returns the normalised version of the given path

public
__construct(string $path)

Initialize the rule with the path

protected
buildConfirmationItem(string $token, string $url)

Generates the confirmation item

protected
string
generateToken(string $path)

Generates the unique token depending on the path

protected
bool
checkPath(string $path)

Checks the given path by the rules and returns whether it should be protected

public
bool
checkRequestForBypass(HTTPRequest $request)

Check the request for whether we can bypass the confirmation

public
null|Item
getRequestConfirmationItem(HTTPRequest $request)

Check the request by the rule and return a confirmation item

Details

string getPath()

Returns the path

Return Value

string

$this setPath(string $path)

Update the path

Parameters

string $path

Return Value

$this

protected string normalisePath(string $path)

Returns the normalised version of the given path

Parameters

string $path

Path to normalise

Return Value

string

normalised version of the path

__construct(string $path)

Initialize the rule with the path

Parameters

string $path

protected Item buildConfirmationItem(string $token, string $url)

Generates the confirmation item

Parameters

string $token
string $url

Return Value

Item

protected string generateToken(string $path)

Generates the unique token depending on the path

Parameters

string $path

URL path

Return Value

string

protected bool checkPath(string $path)

Checks the given path by the rules and returns whether it should be protected

Parameters

string $path

Path to be checked

Return Value

bool

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

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