for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Lug package.
*
* (c) Eric GELOEN <[email protected]>
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/
namespace Lug\Component\Storage\Model;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* @author GeLo <[email protected]>
class CookieStorage implements StorageInterface
{
* @var RequestStack
private $requestStack;
* @param RequestStack $requestStack
public function __construct(RequestStack $requestStack)
$this->requestStack = $requestStack;
}
* {@inheritdoc}
public function offsetExists($offset)
return $this->getCookies()->has($offset);
public function offsetGet($offset)
return $this->getCookies()->get($offset);
public function offsetSet($offset, $value)
$this->getCookies()->set($offset, $value);
public function offsetUnset($offset)
$this->getCookies()->remove($offset);
* @return ParameterBag
private function getCookies()
return $this->requestStack->getMasterRequest()->cookies;