VoteLink
in package
Site-independent handling of links to external game voting sites.
This is used to award free turns to players for voting.
Table of Contents
Constants
- TIME_BETWEEN_VOTING = 84600
Properties
- $accountID : int
- $data : array<string, mixed>
- $gameID : int
- $site : VoteSite
- $CACHE_TIMEOUTS : array<int, int>|null
Methods
- __construct() : mixed
- clearCache() : void
- freeTurnsReady() : bool
- Returns true if account can currently receive free turns at this site.
- getImg() : string
- Returns the image to display for this voting site.
- getMinTimeUntilFreeTurns() : int
- Returns the earliest time (in seconds) until free turns are available across all voting sites.
- getSN() : string|false
- Returns the SN to redirect the current page to if free turns are available; otherwise, returns false.
- getTimeUntilFreeTurns() : int
- Time until the account can get free turns from voting at this site.
- getUrl() : string
- Returns the URL that should be used for this voting site.
- givesFreeTurns() : bool
- Does this VoteSite have a voting callback that can be used to award free turns?
- setClicked() : void
- Register that the player has clicked on a vote site that is eligible for free turns, so that we will accept incoming votes. This ensures that voting is done through an authenticated SMR session.
- setFreeTurnsAwarded() : bool
- Register that the player has been awarded their free turns.
Constants
TIME_BETWEEN_VOTING
public
mixed
TIME_BETWEEN_VOTING
= 84600
Properties
$accountID read-only
public
int
$accountID
$data read-only
public
array<string, mixed>
$data
$gameID read-only
public
int
$gameID
$site read-only
public
VoteSite
$site
$CACHE_TIMEOUTS
private
static array<int, int>|null
$CACHE_TIMEOUTS
= null
Methods
__construct()
public
__construct(VoteSite $site, int $accountID, int $gameID) : mixed
Parameters
- $site : VoteSite
- $accountID : int
- $gameID : int
clearCache()
public
static clearCache() : void
freeTurnsReady()
Returns true if account can currently receive free turns at this site.
public
freeTurnsReady([bool $forceUpdate = false ]) : bool
Parameters
- $forceUpdate : bool = false
Return values
boolgetImg()
Returns the image to display for this voting site.
public
getImg() : string
Return values
stringgetMinTimeUntilFreeTurns()
Returns the earliest time (in seconds) until free turns are available across all voting sites.
public
static getMinTimeUntilFreeTurns(int $accountID, int $gameID) : int
Parameters
- $accountID : int
- $gameID : int
Return values
intgetSN()
Returns the SN to redirect the current page to if free turns are available; otherwise, returns false.
public
getSN() : string|false
Return values
string|falsegetTimeUntilFreeTurns()
Time until the account can get free turns from voting at this site.
public
getTimeUntilFreeTurns([bool $forceUpdate = false ]) : int
If the time is 0, this site is eligible for free turns.
Parameters
- $forceUpdate : bool = false
Return values
intgetUrl()
Returns the URL that should be used for this voting site.
public
getUrl() : string
Return values
stringgivesFreeTurns()
Does this VoteSite have a voting callback that can be used to award free turns?
public
givesFreeTurns() : bool
Return values
boolsetClicked()
Register that the player has clicked on a vote site that is eligible for free turns, so that we will accept incoming votes. This ensures that voting is done through an authenticated SMR session.
public
setClicked() : void
setFreeTurnsAwarded()
Register that the player has been awarded their free turns.
public
setFreeTurnsAwarded() : bool
Return values
bool —True if account was eligible for free turns (i.e. in the setClicked state).