Class Session
-
ICanBoogie\Session
implements
ICanBoogie\SessionOptions,
ICanBoogie\SessionSegment
uses
ICanBoogie\Accessor\AccessorTrait (not available)
ICanBoogie\Session\SegmentTrait
Methods summary
protected
get_id( void )
: string
Returns
string
Codecoverageignore
protected
set_id( string $id
)
protected
get_name( void )
: string
protected
set_name( string $name
)
protected
get_token( void )
: string
protected
get_cache_limiter( void )
: string
protected
set_cache_limiter( string $cache_limiter
)
protected
get_cache_expire( void )
: string
protected
set_cache_expire( string $cache_expire
)
protected
get_module_name( void )
: string
protected
set_module_name( string $module
)
protected
get_save_path( void )
: string
protected
set_save_path( string $path
)
protected
get_cookie_params( void )
: array
protected
set_cookie_params( array $params
)
protected
get_status( void )
: integer
Return the current session status.
Return the current session status.
Returns
integer
protected
get_is_active( void )
: boolean
Whether sessions are enabled, and one exists.
Whether sessions are enabled, and one exists.
Returns
boolean
protected
get_is_disabled( void )
: boolean
Whether sessions are disabled.
Whether sessions are disabled.
Returns
boolean
protected
get_has_none( void )
: boolean
Whether sessions are enabled, but none exists.
Whether sessions are enabled, but none exists.
Returns
boolean
protected
get_is_referenced( void )
: boolean
Whether sessions id is referenced in the cookie.
Whether sessions id is referenced in the cookie.
Returns
boolean
protected
&
get_reference( void )
protected
get_segments( void )
protected
get_flash( void )
public
__construct( array $options
= [] )
public
__call( string $name
, array $arguments
)
Forward selected method to session functions.
Forward selected method to session functions.
Parameters
protected
assert_is_forwardable( string $name
)
Assert that a method is forwardable to a session function.
Assert that a method is forwardable to a session function.
Parameters
Throws
BadMethodCallException
if the method is not forwardable
public
start( void )
: boolean
Initialize session data.
Note: If PHP is running from CLI the session_start()
method is not invoked but a fake
$_SESSION
is still created.
Returns
boolean
See
session_start()
Codecoverageignore
public
start_or_reuse( void )
Start a new session or reuse the current one.
Start a new session or reuse the current one.
public
clear( void )
Clear the session of all data.
Clear the session of all data.
See
session_unset()
Codecoverageignore
Implementation of
public
regenerate( void )
: boolean
Update the current session id and token.
Update the current session id and token.
Returns
boolean
true
on success or false
on failure.
protected
generate_token( void )
: string
Generate a session token.
Generate a session token.
Returns
string
public
verify_token( string $token
)
: boolean
Verify that a given token matches the session's token.
Verify that a given token matches the session's token.
Parameters
Returns
boolean
Methods inherited from ArrayAccess
offsetExists()
,
offsetGet()
,
offsetSet()
,
offsetUnset()
__get()
,
accessor_get()
,
offsetExists()
,
offsetGet()
,
offsetSet()
,
offsetUnset()
Magic methods summary
public
abort( void )
:
Discard session array changes and finish session.
Discard session array changes and finish session.
public
commit( void )
:
Write session data and end session.
Write session data and end session.
public
decode( string $data
)
: boolean
Decodes session data from a session encoded string.
Decodes session data from a session encoded string.
Parameters
Returns
boolean
public
destroy( void )
:
Destroys all data registered to a session.
Destroys all data registered to a session.
public
encode( void )
: string
Encodes the current session data as a session encoded string.
Encodes the current session data as a session encoded string.
Returns
string
public
regenerate_id( $delete_old_session
= false )
: boolean
Update the current session id with a newly generated one.
Update the current session id with a newly generated one.
Parameters
Returns
boolean
public
reset( void )
:
Re-initialize session array with original values.
Re-initialize session array with original values.
Constants summary
TOKEN_NAME
: string
Name of the session token, may be used as form hidden input name.
Name of the session token, may be used as form hidden input name.
'__SESSION_TOKEN__'
DEFAULT_CACHE_EXPIRE
,
DEFAULT_CACHE_LIMITER
,
DEFAULT_ID
,
DEFAULT_MODULE_NAME
,
DEFAULT_NAME
,
DEFAULT_SAVE_PATH
,
OPTION_CACHE_EXPIRE
,
OPTION_CACHE_LIMITER
,
OPTION_COOKIE_PARAMS
,
OPTION_ID
,
OPTION_MODULE_NAME
,
OPTION_NAME
,
OPTION_SAVE_PATH
Properties summary
Magic properties
public
$cache_limiter
: string
public
$cache_expire
: string
public
$cookie_params
: array
Session cookie parameters.
public
$module_name
: string
public
$save_path
: string
Current session save path.
public read-only
$status
: integer
public read-only
$is_disabled
: boolean
Whether sessions are enabled, but none exists.
public read-only
$is_active
: boolean
Whether sessions are enabled, and one exists.
public read-only
$has_none
: boolean
Whether sessions are enabled, but none exists.
public read-only
$is_referenced
: boolean
Whether session id is referenced in the cookie.
public read-only
$token
: string
Current session token that can be used to prevent CSRF.
$reference