RequestControl
in package
Uses
GxAdapterTrait
Class RequestControl
Table of Contents
- $allowedIpsUrl : string
- $curl : CurlClient
- $gxAdapter : mixed
- $tokenDataCacheKey : string
- $tokenLifeSpan : int
- __construct() : mixed
- RequestControl constructor.
- createRequestToken() : string
- Creates a new request token and returns it.
- setGxAdapter() : mixed
- verifyRequestIp() : bool
- Checks a given ip and tries to verify it.
- verifyRequestToken() : bool
- Checks a given token and tries to verify it.
- deleteOldRequestTokens() : void
- Deletes old request tokens.
- getRequestTokens() : array<string|int, mixed>
- Returns all active and existing request tokens.
- gxAdapter() : GxAdapter
Properties
$allowedIpsUrl
private
string
$allowedIpsUrl
= 'https://core-api.gambiohub.com/trust/allowed_admin_feed_ips.json'
$curl
private
CurlClient
$curl
$gxAdapter
private
mixed
$gxAdapter
$tokenDataCacheKey
private
string
$tokenDataCacheKey
= 'admin-feed-request-tokens'
$tokenLifeSpan
private
int
$tokenLifeSpan
= 300
Methods
__construct()
RequestControl constructor.
public
__construct(CurlClient $curl) : mixed
Parameters
- $curl : CurlClient
Return values
mixed —createRequestToken()
Creates a new request token and returns it.
public
createRequestToken() : string
Return values
string —setGxAdapter()
public
setGxAdapter(GxAdapter $adapter) : mixed
Parameters
- $adapter : GxAdapter
Return values
mixed —verifyRequestIp()
Checks a given ip and tries to verify it.
public
verifyRequestIp(string $ip) : bool
Parameters
- $ip : string
Return values
bool —Returns true, if the given ip is valid, otherwise false will be returned.
verifyRequestToken()
Checks a given token and tries to verify it.
public
verifyRequestToken(string $token) : bool
Parameters
- $token : string
Return values
bool —Returns true, if the given token is valid, otherwise false will be returned.
deleteOldRequestTokens()
Deletes old request tokens.
private
deleteOldRequestTokens() : void
Return values
void —getRequestTokens()
Returns all active and existing request tokens.
private
getRequestTokens() : array<string|int, mixed>
Return values
array<string|int, mixed> —gxAdapter()
private
gxAdapter() : GxAdapter