alltube/classes/SessionManager.php
Pierre Rudloff 1387d836dc refactor: New Session class
So that session is shared between classes and does not get overwritten
2019-04-22 17:03:54 +02:00

37 lines
603 B
PHP

<?php
/**
* 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);
}
return self::$session;
}
}