2019-04-22 15:00:51 +00:00
|
|
|
<?php
|
2019-10-03 19:24:12 +00:00
|
|
|
|
2019-04-22 15:00:51 +00:00
|
|
|
/**
|
|
|
|
* SessionManager class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Alltube;
|
|
|
|
|
|
|
|
use Aura\Session\Session;
|
|
|
|
use Aura\Session\SessionFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage sessions.
|
|
|
|
*/
|
|
|
|
class SessionManager
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Current session.
|
|
|
|
*
|
|
|
|
* @var Session
|
|
|
|
*/
|
|
|
|
private static $session;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current session.
|
|
|
|
*
|
|
|
|
* @return Session
|
|
|
|
*/
|
|
|
|
public static function getSession()
|
|
|
|
{
|
|
|
|
if (!isset(self::$session)) {
|
|
|
|
$session_factory = new SessionFactory();
|
|
|
|
self::$session = $session_factory->newInstance($_COOKIE);
|
|
|
|
}
|
2019-04-22 15:04:59 +00:00
|
|
|
|
2019-04-22 15:00:51 +00:00
|
|
|
return self::$session;
|
|
|
|
}
|
|
|
|
}
|