phpOMS/DataStorage/Session/SessionAbstract.php
Dennis Eichhorn 6cdf51c207
Some checks are pending
CI / general_module_workflow_php (push) Waiting to run
fix languages 3
2024-05-18 16:22:32 +00:00

106 lines
2.0 KiB
PHP

<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package phpOMS\DataStorage\Session
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace phpOMS\DataStorage\Session;
/**
* Session interface.
*
* Sessions can be used by http requests, console interaction and socket connections
*
* @package phpOMS\DataStorage\Session
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class SessionAbstract
{
/**
* Raw session data.
*
* @var array<string, mixed>
* @since 1.0.0
*/
public array $data = [];
/**
* Get session variable by key.
*
* @param string $key Value key
*
* @return mixed
*
* @since 1.0.0
*/
public abstract function get(string $key) : mixed;
/**
* Store session value by key.
*
* @param string $key Value key
* @param mixed $value Value to store
* @param bool $overwrite Overwrite existing values
*
* @return bool
*
* @since 1.0.0
*/
public abstract function set(string $key, mixed $value, bool $overwrite = false) : bool;
/**
* Remove value from session by key.
*
* @param string $key Value key
*
* @return bool
*
* @since 1.0.0
*/
public abstract function remove(string $key) : bool;
/**
* Save session.
*
* @return bool
*
* @since 1.0.0
*/
public abstract function save() : bool;
/**
* @return string
*
* @since 1.0.0
*/
public abstract function getSID() : string;
/**
* @param string $sid Session id
*
* @return void
*
* @since 1.0.0
*/
public abstract function setSID(string $sid) : void;
/**
* Lock session from further adjustments.
*
* @return void
*
* @since 1.0.0
*/
public abstract function lock() : void;
}