class ConfirmationMiddleware implements HTTPMiddleware

Checks whether user manual confirmation is required for HTTPRequest depending on the rules given.

How it works: - Gives the request to every single rule - If no confirmation items are found by the rules, then move on to the next middleware - initialize the Confirmation\Storage with all the confirmation items found - Check whether the storage has them confirmed already and if yes, move on to the next middleware - Otherwise redirect to the confirmation URL

Methods

__construct(Rule[] $rules)

Init the middleware with the rules

$this
setDeclineUrl(string $url)

Override the default decline url

bool
canBypass(HTTPRequest $request)

Check whether the rules can be bypassed without user confirmation

Item[]
getConfirmationItems(HTTPRequest $request)

Extract the confirmation items from the request and return

process(HTTPRequest $request, callable $delegate)

Generate response for the given request

$this
setConfirmationStorageId(string $id)

Override the confirmation storage ID

$this
setConfirmationFormUrl(string $url)

Override the confirmation form url

$this
setBypasses(Bypass[] $bypasses)

Set the list of bypasses for the confirmation

Details

at line 68
__construct(Rule[] $rules)

Init the middleware with the rules

Parameters

Rule[] $rules Rules to check requests against

at line 110
$this setDeclineUrl(string $url)

Override the default decline url

Parameters

string $url

Return Value

$this

at line 124
bool canBypass(HTTPRequest $request)

Check whether the rules can be bypassed without user confirmation

Parameters

HTTPRequest $request

Return Value

bool

at line 142
Item[] getConfirmationItems(HTTPRequest $request)

Extract the confirmation items from the request and return

Parameters

HTTPRequest $request

Return Value

Item[] list of confirmation items

at line 240
HTTPResponse process(HTTPRequest $request, callable $delegate)

Generate response for the given request

Parameters

HTTPRequest $request
callable $delegate

Return Value

HTTPResponse

at line 264
$this setConfirmationStorageId(string $id)

Override the confirmation storage ID

Parameters

string $id

Return Value

$this

at line 277
$this setConfirmationFormUrl(string $url)

Override the confirmation form url

Parameters

string $url

Return Value

$this

at line 290
$this setBypasses(Bypass[] $bypasses)

Set the list of bypasses for the confirmation

Parameters

Bypass[] $bypasses

Return Value

$this