SessionNamespace
extends AbstractSession
in package
Session namespace class
Tags
Table of Contents
Properties
- $namespace : string|null
- Session namespace
Methods
- __construct() : mixed
- Constructor
- __get() : mixed
- Get method to return the value of the $_SESSION global variable
- __isset() : bool
- Return the isset value of the $_SESSION global variable
- __set() : void
- Set a property in the session object that is linked to the $_SESSION global variable
- __unset() : void
- Unset the $_SESSION global variable
- count() : int
- Method to get the count of data in the session
- getIterator() : ArrayIterator
- Method to iterate over the session
- getNamespace() : string
- Get current namespace
- jsonSerialize() : array<string|int, mixed>
- Get the session values for JSON serialization
- kill() : void
- Kill the session namespace
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- setNamespace() : SessionNamespace
- Set current namespace
- setRequestValue() : SessionNamespace
- Set a request-based value
- setTimedValue() : SessionNamespace
- Set a time-based value
- sweep() : SessionNamespace
- Manually check request-based and time-based values, removing any that have expired or exceeded their hop limit
- toArray() : array<string|int, mixed>
- Get the session values as an array
- checkExpirationValue() : void
- Check a single time-based value against its expiration, removing it once expired
- checkExpirationValues() : void
- Check all time-based values against their expirations
- checkRequestValue() : void
- Check a single request-based value against its hop limit, removing it once the limit is exceeded
- checkRequestValues() : void
- Check all request-based values against their hop limits
- init() : void
- Init the session
Properties
$namespace
Session namespace
private
string|null
$namespace
= null
Methods
__construct()
Constructor
public
__construct(string $namespace) : mixed
Private method to instantiate the session object
Parameters
- $namespace : string
Tags
__get()
Get method to return the value of the $_SESSION global variable
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
Return the isset value of the $_SESSION global variable
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Set a property in the session object that is linked to the $_SESSION global variable
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__unset()
Unset the $_SESSION global variable
public
__unset(string $name) : void
Parameters
- $name : string
count()
Method to get the count of data in the session
public
count() : int
Return values
intgetIterator()
Method to iterate over the session
public
getIterator() : ArrayIterator
Return values
ArrayIteratorgetNamespace()
Get current namespace
public
getNamespace() : string
Return values
stringjsonSerialize()
Get the session values for JSON serialization
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>kill()
Kill the session namespace
public
kill([bool $all = false ]) : void
Parameters
- $all : bool = false
offsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
setNamespace()
Set current namespace
public
setNamespace(string $namespace) : SessionNamespace
Parameters
- $namespace : string
Return values
SessionNamespacesetRequestValue()
Set a request-based value
public
setRequestValue(string $key, mixed $value[, int $hops = 1 ]) : SessionNamespace
Parameters
- $key : string
- $value : mixed
- $hops : int = 1
Return values
SessionNamespacesetTimedValue()
Set a time-based value
public
setTimedValue(string $key, mixed $value[, int $expire = 300 ]) : SessionNamespace
Parameters
- $key : string
- $value : mixed
- $expire : int = 300
Return values
SessionNamespacesweep()
Manually check request-based and time-based values, removing any that have expired or exceeded their hop limit
public
sweep() : SessionNamespace
Return values
SessionNamespacetoArray()
Get the session values as an array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>checkExpirationValue()
Check a single time-based value against its expiration, removing it once expired
protected
checkExpirationValue(string $key, array<string|int, mixed> &$data, array<string|int, mixed> &$bookkeeping) : void
Parameters
- $key : string
- $data : array<string|int, mixed>
- $bookkeeping : array<string|int, mixed>
checkExpirationValues()
Check all time-based values against their expirations
protected
checkExpirationValues(array<string|int, mixed> &$data, array<string|int, mixed> &$bookkeeping) : void
Parameters
- $data : array<string|int, mixed>
- $bookkeeping : array<string|int, mixed>
checkRequestValue()
Check a single request-based value against its hop limit, removing it once the limit is exceeded
protected
checkRequestValue(string $key, array<string|int, mixed> &$data, array<string|int, mixed> &$bookkeeping) : void
Parameters
- $key : string
- $data : array<string|int, mixed>
- $bookkeeping : array<string|int, mixed>
checkRequestValues()
Check all request-based values against their hop limits
protected
checkRequestValues(array<string|int, mixed> &$data, array<string|int, mixed> &$bookkeeping) : void
Parameters
- $data : array<string|int, mixed>
- $bookkeeping : array<string|int, mixed>
init()
Init the session
private
init() : void