mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
This commit is contained in:
parent
a25870500e
commit
6cdf51c207
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
|||
namespace phpOMS\Account;
|
||||
|
||||
use phpOMS\Auth\Auth;
|
||||
use phpOMS\DataStorage\Session\SessionInterface;
|
||||
use phpOMS\DataStorage\Session\SessionAbstract;
|
||||
|
||||
/**
|
||||
* Account manager class.
|
||||
|
|
@ -40,19 +40,19 @@ final class AccountManager implements \Countable
|
|||
/**
|
||||
* Session.
|
||||
*
|
||||
* @var SessionInterface
|
||||
* @var SessionAbstract
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private SessionInterface $session;
|
||||
private SessionAbstract $session;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param SessionInterface $session Session
|
||||
* @param SessionAbstract $session Session
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(SessionInterface $session)
|
||||
public function __construct(SessionAbstract $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use phpOMS\Config\SettingsInterface;
|
|||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Session\SessionInterface;
|
||||
use phpOMS\DataStorage\Session\SessionAbstract;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\L11nManager;
|
||||
|
|
@ -42,7 +42,7 @@ use phpOMS\Router\RouterInterface;
|
|||
* @property \phpOMS\Localization\L11nManager $l11nManager
|
||||
* @property \phpOMS\Localization\Localization $l11nServer
|
||||
* @property \phpOMS\Router\RouterInterface $router
|
||||
* @property \phpOMS\DataStorage\Session\SessionInterface $sessionManager
|
||||
* @property \phpOMS\DataStorage\Session\SessionAbstract $sessionManager
|
||||
* @property \phpOMS\DataStorage\Cookie\CookieJar $cookieJar
|
||||
* @property \phpOMS\Module\ModuleManager $moduleManager
|
||||
* @property \phpOMS\Dispatcher\Dispatcher $dispatcher
|
||||
|
|
@ -150,10 +150,10 @@ class ApplicationAbstract
|
|||
/**
|
||||
* Session instance.
|
||||
*
|
||||
* @var SessionInterface
|
||||
* @var SessionAbstract
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected SessionInterface $sessionManager;
|
||||
protected SessionAbstract $sessionManager;
|
||||
|
||||
/**
|
||||
* Cookie instance.
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Auth;
|
||||
|
||||
use phpOMS\DataStorage\Session\SessionInterface;
|
||||
use phpOMS\DataStorage\Session\SessionAbstract;
|
||||
|
||||
/**
|
||||
* Auth class.
|
||||
|
|
@ -41,13 +41,13 @@ final class Auth
|
|||
/**
|
||||
* Authenticates user.
|
||||
*
|
||||
* @param SessionInterface $session Session
|
||||
* @param SessionAbstract $session Session
|
||||
*
|
||||
* @return int Returns the user id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function authenticate(SessionInterface $session) : int
|
||||
public static function authenticate(SessionAbstract $session) : int
|
||||
{
|
||||
$uid = $session->get('UID');
|
||||
|
||||
|
|
@ -57,13 +57,13 @@ final class Auth
|
|||
/**
|
||||
* Logout the given user.
|
||||
*
|
||||
* @param SessionInterface $session Session
|
||||
* @param SessionAbstract $session Session
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function logout(SessionInterface $session) : void
|
||||
public static function logout(SessionAbstract $session) : void
|
||||
{
|
||||
$session->remove('UID');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use phpOMS\Uri\UriFactory;
|
|||
*
|
||||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*/
|
||||
final class HttpSession implements SessionInterface
|
||||
final class HttpSession extends SessionAbstract
|
||||
{
|
||||
/**
|
||||
* Is session locked/already set.
|
||||
|
|
@ -38,14 +38,6 @@ final class HttpSession implements SessionInterface
|
|||
*/
|
||||
private bool $isLocked = false;
|
||||
|
||||
/**
|
||||
* Raw session data.
|
||||
*
|
||||
* @var array<string, mixed>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public array $data = [];
|
||||
|
||||
/**
|
||||
* Session ID.
|
||||
*
|
||||
|
|
|
|||
26
DataStorage/Session/SessionInterface.php → DataStorage/Session/SessionAbstract.php
Executable file → Normal file
26
DataStorage/Session/SessionInterface.php → DataStorage/Session/SessionAbstract.php
Executable file → Normal file
|
|
@ -23,11 +23,17 @@ namespace phpOMS\DataStorage\Session;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @property array $data
|
||||
*/
|
||||
interface SessionInterface
|
||||
abstract class SessionAbstract
|
||||
{
|
||||
/**
|
||||
* Raw session data.
|
||||
*
|
||||
* @var array<string, mixed>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public array $data = [];
|
||||
|
||||
/**
|
||||
* Get session variable by key.
|
||||
*
|
||||
|
|
@ -37,7 +43,7 @@ interface SessionInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get(string $key) : mixed;
|
||||
public abstract function get(string $key) : mixed;
|
||||
|
||||
/**
|
||||
* Store session value by key.
|
||||
|
|
@ -50,7 +56,7 @@ interface SessionInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function set(string $key, mixed $value, bool $overwrite = false) : bool;
|
||||
public abstract function set(string $key, mixed $value, bool $overwrite = false) : bool;
|
||||
|
||||
/**
|
||||
* Remove value from session by key.
|
||||
|
|
@ -61,7 +67,7 @@ interface SessionInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function remove(string $key) : bool;
|
||||
public abstract function remove(string $key) : bool;
|
||||
|
||||
/**
|
||||
* Save session.
|
||||
|
|
@ -70,14 +76,14 @@ interface SessionInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function save() : bool;
|
||||
public abstract function save() : bool;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSID() : string;
|
||||
public abstract function getSID() : string;
|
||||
|
||||
/**
|
||||
* @param string $sid Session id
|
||||
|
|
@ -86,7 +92,7 @@ interface SessionInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setSID(string $sid) : void;
|
||||
public abstract function setSID(string $sid) : void;
|
||||
|
||||
/**
|
||||
* Lock session from further adjustments.
|
||||
|
|
@ -95,5 +101,5 @@ interface SessionInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function lock() : void;
|
||||
public abstract function lock() : void;
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ abstract class TaskAbstract
|
|||
/**
|
||||
* Create task based on job data
|
||||
*
|
||||
* @param array<int, mixed> $jobData Raw job data
|
||||
* @param string[] $jobData Raw job data
|
||||
*
|
||||
* @return TaskAbstract
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user