Documentation

Session
in package

Table of Contents

Constants

TIME_BEFORE_EXPIRY  = 172800
URL_LOAD_DELAY  = [\Smr\Pages\Player\HardwareConfigure::class => 0.4, \Smr\Pages\Player\ForcesDrop::class => 0.4, \Smr\Pages\Player\ForcesDropProcessor::class => 0.5, \Smr\Pages\Player\ForcesRefreshProcessor::class => 0.4, \Smr\Pages\Player\SectorJumpProcessor::class => 0.4, \Smr\Pages\Player\SectorMoveProcessor::class => 0.4, \Smr\Pages\Player\SectorScan::class => 0.4, \Smr\Pages\Player\ShopGoodsProcessor::class => 0.4, \Smr\Pages\Player\AttackPlayerProcessor::class => 0.75, \Smr\Pages\Player\ExamineTrader::class => 0.75]

Properties

$ajax  : bool
$ajaxReturns  : array<string, string>
$previousAjaxReturns  : array<string, string>|null
$accountID  : int
$currentPage  : Page|null
$gameID  : int
$generate  : bool
$lastAccessed  : float
$lastSN  : string
$links  : array<string, Page>
$requestData  : array<string, mixed>
$sessionID  : string
$SN  : string

Methods

__construct()  : mixed
Smr\Session constructor.
addAjaxReturns()  : bool
addLink()  : string
Add a page to the session so that it can be used on next page load.
clearLinks()  : void
destroy()  : void
fetchVarInfo()  : void
getAccount()  : Account
getAccountID()  : int
getCurrentVar()  : Page
Returns the session var associated with the current SN.
getGameID()  : int
Returns the Game ID associated with the session.
getInstance()  : self
Return the Smr\Session in the DI container.
getLastAccessed()  : float
getPlayer()  : AbstractPlayer
getRequestData()  : array<string, mixed>
getRequestVar()  : string
Gets a var from $var, $_REQUEST, or $default. Then stores it in the session so that it can still be retrieved when the page auto-refreshes.
getRequestVarInt()  : int
getRequestVarIntArray()  : array<int, int>
getSessionID()  : string
Uniquely identifies the session in the database.
getSN()  : string
The SN is the URL parameter that defines the page being requested.
hasAccount()  : bool
hasChangedSN()  : bool
Returns true if the current SN is different than the previous SN.
hasCurrentVar()  : bool
Check if the session has a var associated with the current SN.
hasGame()  : bool
Returns true if the session is inside a game, false otherwise.
saveAjaxReturns()  : void
setAccount()  : void
Sets the `accountID` attribute of this session.
setCurrentVar()  : void
Replace the global $var with the given $container.
update()  : void
updateGame()  : void
Updates the `gameID` attribute of the session and deletes any other active sessions in this game for this account.

Constants

TIME_BEFORE_EXPIRY

private mixed TIME_BEFORE_EXPIRY = 172800

URL_LOAD_DELAY

private mixed URL_LOAD_DELAY = [\Smr\Pages\Player\HardwareConfigure::class => 0.4, \Smr\Pages\Player\ForcesDrop::class => 0.4, \Smr\Pages\Player\ForcesDropProcessor::class => 0.5, \Smr\Pages\Player\ForcesRefreshProcessor::class => 0.4, \Smr\Pages\Player\SectorJumpProcessor::class => 0.4, \Smr\Pages\Player\SectorMoveProcessor::class => 0.4, \Smr\Pages\Player\SectorScan::class => 0.4, \Smr\Pages\Player\ShopGoodsProcessor::class => 0.4, \Smr\Pages\Player\AttackPlayerProcessor::class => 0.75, \Smr\Pages\Player\ExamineTrader::class => 0.75]

Properties

$ajaxReturns

protected array<string, string> $ajaxReturns = []

$previousAjaxReturns

protected array<string, string>|null $previousAjaxReturns

$lastAccessed

private float $lastAccessed

$requestData

private array<string, mixed> $requestData = []

$sessionID

private string $sessionID

Methods

__construct()

Smr\Session constructor.

public __construct() : mixed

Not intended to be constructed by hand. Use Smr\Session::getInstance().

addAjaxReturns()

public addAjaxReturns(string $element, string $contents) : bool
Parameters
$element : string
$contents : string
Return values
bool

Add a page to the session so that it can be used on next page load.

public addLink(Page $container) : string

It will be associated with an SN that will be used for linking.

Parameters
$container : Page
Return values
string
public clearLinks() : void

fetchVarInfo()

public fetchVarInfo() : void

getAccountID()

public getAccountID() : int
Return values
int

getCurrentVar()

Returns the session var associated with the current SN.

public getCurrentVar() : Page
Return values
Page

getGameID()

Returns the Game ID associated with the session.

public getGameID() : int
Return values
int

getInstance()

Return the Smr\Session in the DI container.

public static getInstance() : self

If one does not exist yet, it will be created. This is the intended way to construct this class.

Return values
self

getLastAccessed()

public getLastAccessed() : float
Return values
float

getRequestData()

public getRequestData() : array<string, mixed>
Return values
array<string, mixed>

getRequestVar()

Gets a var from $var, $_REQUEST, or $default. Then stores it in the session so that it can still be retrieved when the page auto-refreshes.

public getRequestVar(string $varName[, string $default = null ]) : string

This is the recommended way to get $_REQUEST data for display pages. For processing pages, see the Request class.

Parameters
$varName : string
$default : string = null
Return values
string

getRequestVarInt()

public getRequestVarInt(string $varName[, int $default = null ]) : int
Parameters
$varName : string
$default : int = null
Return values
int

getRequestVarIntArray()

public getRequestVarIntArray(string $varName[, array<int, int>|null $default = null ]) : array<int, int>
Parameters
$varName : string
$default : array<int, int>|null = null
Return values
array<int, int>

getSessionID()

Uniquely identifies the session in the database.

public getSessionID() : string
Return values
string

getSN()

The SN is the URL parameter that defines the page being requested.

public getSN() : string
Return values
string

hasAccount()

public hasAccount() : bool
Return values
bool

hasChangedSN()

Returns true if the current SN is different than the previous SN.

public hasChangedSN() : bool
Return values
bool

hasCurrentVar()

Check if the session has a var associated with the current SN.

public hasCurrentVar() : bool
Return values
bool

hasGame()

Returns true if the session is inside a game, false otherwise.

public hasGame() : bool
Return values
bool

saveAjaxReturns()

public saveAjaxReturns() : void

setAccount()

Sets the `accountID` attribute of this session.

public setAccount(Account $account) : void
Parameters
$account : Account

setCurrentVar()

Replace the global $var with the given $container.

public setCurrentVar(Page $container) : void
Parameters
$container : Page

updateGame()

Updates the `gameID` attribute of the session and deletes any other active sessions in this game for this account.

public updateGame(int $gameID) : void
Parameters
$gameID : int

        
On this page

Search results