FacturaScripts

MultiRequestProtection
in package

Class to prevent duplicated petitions.

Table of Contents

Constants

CACHE_KEY  = 'MultiRequestProtection'
MAX_TOKEN_AGE  = 4
MAX_TOKENS  = 500
RANDOM_STRING_LENGTH  = 6

Properties

$seed  : string

Methods

__construct()  : mixed
addSeed()  : void
clearSeed()  : void
newToken()  : string
Generates a random token.
tokenExist()  : bool
Validates if a petition token exist, otherwise save it.
validate()  : bool
getRandomStr()  : string
getTokens()  : array<string|int, mixed>
saveToken()  : bool
Saves the new token to cache.

Constants

Properties

Methods

tokenExist()

Validates if a petition token exist, otherwise save it.

public tokenExist(string $token) : bool
Parameters
$token : string
Return values
bool

getTokens()

protected getTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>

saveToken()

Saves the new token to cache.

protected saveToken(string $token) : bool
Parameters
$token : string
Return values
bool

        
On this page

Search results