ICanBoogie
  • Documentation
  • API Reference
  • Session master
Namespaces
  • ICanBoogie
    • Session
Classes
  • Session
Interfaces
  • SessionFlash
  • SessionOptions
  • SessionSegment

Class Session

Session.

ICanBoogie\Session implements ICanBoogie\SessionOptions, ICanBoogie\SessionSegment uses ICanBoogie\Accessor\AccessorTrait (not available) ICanBoogie\Session\SegmentTrait
Namespace: ICanBoogie
Located at Session.php

Methods summary

protected get_id( void ) : string

Returns

string

Codecoverageignore

protected set_id( string $id )

Parameters

$id
protected get_name( void ) : string

Returns

string
protected set_name( string $name )

Parameters

$name
protected get_token( void ) : string

Returns

string
protected get_cache_limiter( void ) : string

Returns

string
protected set_cache_limiter( string $cache_limiter )

Parameters

$cache_limiter
protected get_cache_expire( void ) : string

Returns

string
protected set_cache_expire( string $cache_expire )

Parameters

$cache_expire
protected get_module_name( void ) : string

Returns

string
protected set_module_name( string $module )

Parameters

$module
protected get_save_path( void ) : string

Returns

string
protected set_save_path( string $path )

Parameters

$path
protected get_cookie_params( void ) : array

Returns

array
protected set_cookie_params( array $params )

Parameters

$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 )

Inheritdoc

protected get_segments( void )
protected get_flash( void )

Inheritdoc

public __construct( array $options = [] )

Parameters

$options
public __call( string $name, array $arguments )

Forward selected method to session functions.

Forward selected method to session functions.

Parameters

$name
$arguments
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

$name

Throws

BadMethodCallException
if the method is not forwardable
public start( void ) : boolean

Initialize session data.

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

ICanBoogie\SessionSegment::clear()
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

$token

Returns

boolean

Methods inherited from ArrayAccess

offsetExists(), offsetGet(), offsetSet(), offsetUnset()

Methods used from ICanBoogie\Session\SegmentTrait

__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

$data

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

$delete_old_session

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__'

Constants inherited from ICanBoogie\SessionOptions

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 $id : string

Current session id.

public $name : string

Current session name.

public $cache_limiter : string

Current cache limiter.

public $cache_expire : string

Current cache expire.

public $cookie_params : array

Session cookie parameters.

public $module_name : string

Current session module.

public $save_path : string

Current session save path.

public $flash : ICanBoogie\SessionFlash

The session flash.

public read-only $status : integer

Current session status.

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 $segments : ICanBoogie\Session\SegmentCollection

Session segments.

public read-only $token : string

Current session token that can be used to prevent CSRF.

Magic properties used from ICanBoogie\Session\SegmentTrait

$reference

Session master – Check on GitHub – API documentation generated by ApiGen