refactor: New Session class

So that session is shared between classes and does not get overwritten
This commit is contained in:
Pierre Rudloff 2019-04-22 17:00:51 +02:00
parent 25f33bba56
commit 1387d836dc
5 changed files with 48 additions and 18 deletions

View file

@ -6,7 +6,6 @@
namespace Alltube;
use Aura\Session\Segment;
use Aura\Session\SessionFactory;
use Symfony\Component\Process\Process;
/**
@ -37,13 +36,10 @@ class LocaleManager
/**
* LocaleManager constructor.
*
* @param array $cookies Cookie array
*/
public function __construct(array $cookies = [])
public function __construct()
{
$session_factory = new SessionFactory();
$session = $session_factory->newInstance($cookies);
$session = SessionManager::getSession();
$this->sessionSegment = $session->getSegment(self::class);
$cookieLocale = $this->sessionSegment->get('locale');
if (isset($cookieLocale)) {