Allow custom cookie array in controller

This commit is contained in:
Pierre Rudloff 2017-04-25 23:04:59 +02:00
parent 5e31767140
commit 8aee9054a8
2 changed files with 5 additions and 3 deletions

View file

@ -65,8 +65,10 @@ class FrontController
* FrontController constructor.
*
* @param Container $container Slim dependency container
* @param Config $config Config instance
* @param array $cookies Cookie array
*/
public function __construct(ContainerInterface $container, Config $config = null)
public function __construct(ContainerInterface $container, Config $config = null, array $cookies = [])
{
if (isset($config)) {
$this->config = $config;
@ -77,7 +79,7 @@ class FrontController
$this->container = $container;
$this->view = $this->container->get('view');
$session_factory = new \Aura\Session\SessionFactory();
$session = $session_factory->newInstance($_COOKIE);
$session = $session_factory->newInstance($cookies);
$this->sessionSegment = $session->getSegment('Alltube\Controller\FrontController');
if ($this->config->stream) {
$this->defaultFormat = 'best';

View file

@ -28,7 +28,7 @@ $container['view'] = function ($c) {
return $view;
};
$controller = new FrontController($container);
$controller = new FrontController($container, null, $_COOKIE);
$container['errorHandler'] = [$controller, 'error'];