92 lines
1.3 KiB
PHP
92 lines
1.3 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace alveolata\session;
|
||
|
|
||
|
// require_once(DIR_ALVEOLATA . '/definitions.php');
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @author Christian Fraß <frass@greenscale.de>
|
||
|
* @todo consider to allow "any" keys and offer an option to specify the encoder and decoder
|
||
|
*/
|
||
|
interface interface_session {
|
||
|
|
||
|
/**
|
||
|
* shall create a new session instance, i.e. starting a new session
|
||
|
*
|
||
|
* @return interface_session
|
||
|
*/
|
||
|
public static function begin(
|
||
|
) : interface_session
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* shall recover the session instance by a given ID
|
||
|
*
|
||
|
* @param string $id
|
||
|
* @return interface_session
|
||
|
*/
|
||
|
public static function get(
|
||
|
string $id
|
||
|
) : interface_session
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* shall return the generated ID, which has been assigned to the session
|
||
|
*
|
||
|
* @return string
|
||
|
*/
|
||
|
public function id(
|
||
|
) : string
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* shall read a specific value from the session data
|
||
|
*
|
||
|
* @param string $key
|
||
|
* @return string
|
||
|
*/
|
||
|
public function read(
|
||
|
string $key
|
||
|
) : string
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* shall write a specific value to the session data
|
||
|
*
|
||
|
* @param string $key
|
||
|
* @param string $value
|
||
|
*/
|
||
|
public function write(
|
||
|
string $key,
|
||
|
string $value
|
||
|
) : void
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* shall remove a specific value from the session data
|
||
|
* @param string $key
|
||
|
*/
|
||
|
public function remove(
|
||
|
string $key
|
||
|
) : void
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* shall terminate the session
|
||
|
*
|
||
|
*/
|
||
|
public function end(
|
||
|
) : void
|
||
|
;
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|