for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace PublishingKit\Csrf;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
final class SymfonySessionTokenStorage implements TokenStorage
{
/**
* @var SessionInterface
*/
private $session;
public function __construct(SessionInterface $session)
$this->session = $session;
}
public function store(string $key, Token $token): void
$this->session->set($key, $token->__toString());
public function retrieve(string $key): ?Token
/** @var string|null **/
$tokenValue = $this->session->get($key);
if ($tokenValue === null) {
return null;
return new Token($tokenValue);