PHP Interface PSR7Sessions\Storageless\Session\SessionInterface

Inheritance: extends JsonSerializable
显示文件 Open project: Ocramius/PSR7Session Interface Usage Examples

Public Methods

Method Description
clear ( ) : void Clears the contents of the session
get ( string $key, integer | boolean | string | float | array | object | JsonSerializable $default = null ) : integer | boolean | string | float | array Retrieves a value from the session - if the value doesn't exist, then it uses the given $default, but transformed into a immutable and safely manipulated scalar or array
has ( string $key ) : boolean Checks whether a given key exists in the session
hasChanged ( ) : boolean Checks whether the session has changed its contents since its lifecycle start
isEmpty ( ) : boolean Checks whether the session contains any data
remove ( string $key ) : void Removes an item from the session
set ( string $key, integer | boolean | string | float | array | object | JsonSerializable $value ) : void Stores a given value in the session

Method Details

clear() public method

Clears the contents of the session
public clear ( ) : void
return void

get() public method

Retrieves a value from the session - if the value doesn't exist, then it uses the given $default, but transformed into a immutable and safely manipulated scalar or array
public get ( string $key, integer | boolean | string | float | array | object | JsonSerializable $default = null ) : integer | boolean | string | float | array
$key string
$default integer | boolean | string | float | array | object | JsonSerializable
return integer | boolean | string | float | array

has() public method

Checks whether a given key exists in the session
public has ( string $key ) : boolean
$key string
return boolean

hasChanged() public method

Checks whether the session has changed its contents since its lifecycle start
public hasChanged ( ) : boolean
return boolean

isEmpty() public method

Checks whether the session contains any data
public isEmpty ( ) : boolean
return boolean

remove() public method

Removes an item from the session
public remove ( string $key ) : void
$key string
return void

set() public method

Stores a given value in the session
public set ( string $key, integer | boolean | string | float | array | object | JsonSerializable $value ) : void
$key string
$value integer | boolean | string | float | array | object | JsonSerializable allows any nested combination of the previous types as well
return void