Session
class Session
Class Session.
Tools for managing sessions, including session segments and read-once messages
Traits
Properties
static protected bool | $singletonArray | Set to true if you want use more that one singleton using and index param in getInstance | from Singleton |
static protected string | $basePath | The base path where config files are placed. | from Singleton |
static private string | $className | Name of the class | from Singleton |
static private array | $instances | Hold the classes on instance. | from Singleton |
protected bool | $separateConfigFile | Set to true if you want to save configuration in a separate file | from Singleton |
protected Session | $session | Session info from cookie. | |
protected string | $segmentName | Segment name. |
Methods
Return this instance.
Save config to file.
Return default values
Initialization, equivalent to __construct and must be called from main class.
Session constructor.
Gets the value of the outgoing CSRF token.
Checks whether an incoming CSRF token value is valid.
Return this session.
Sets segment name.
Get data from segment.
Return segment session.
Set data key.
Sets flash next data by key.
Sets flash next data by key.
Get flash now data by key.
Get flash now data by key.
Sets flash now data by key.
Get flash next data by key.
Details
at line 65
static
Session
getInstance()
Return this instance.
in
Singleton
at line 88
static private string
getClassName()
Returns the class name.
in
Singleton
at line 103
bool
setConfig(array $params, bool $merge = true, string $index = 'main')
Save config to file.
in
Singleton
at line 130
private array
getYamlContent()
Returns the content of the Yaml file.
in
Singleton
at line 152
string
getFilePath()
Return the full file config path.
in
Singleton
at line 162
string
getFileName()
Return the file name.
in
Singleton
at line 172
static string
yamlName()
Return the classname for yaml file.
in
Singleton
at line 184
protected bool
fileExists(string $filename)
Returns if file exists.
in
Singleton
at line 196
array
getConfig(string $index = 'main')
Returns the yaml config params.
at line 75
static array
getDefaultValues()
Return default values
in
Singleton
at line 215
string
getBasePath()
Return the base path.
in
Singleton
at line 223
protected
initSingleton()
Initialization, equivalent to __construct and must be called from main class.
at line 43
__construct()
Session constructor.
at line 86
string
getCsrfToken()
Gets the value of the outgoing CSRF token.
at line 98
bool
isValid(string $csrfToken)
Checks whether an incoming CSRF token value is valid.
at line 108
Session
getSession()
Return this session.
at line 120
Session
setSegment(string $segmentName)
Sets segment name.
at line 133
mixed
get(string $key)
Get data from segment.
at line 143
Segment
getSegment()
Return segment session.
at line 156
$this
set(string $key, mixed $value)
Set data key.
at line 170
$this
setFlash(string $key, mixed $value)
Sets flash next data by key.
at line 184
$this
setFlashNext(string $key, mixed $value)
Sets flash next data by key.
at line 197
mixed
getFlash(string $key)
Get flash now data by key.
at line 209
mixed
getFlashNow(string $key)
Get flash now data by key.
at line 222
$this
setFlashNow(string $key, mixed $value)
Sets flash now data by key.
at line 235
mixed
getFlashNext(string $key)
Get flash next data by key.