vendor/sylius/resource-bundle/src/Bundle/Storage/SessionStorage.php line 36

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\ResourceBundle\Storage;
  12. use Sylius\Component\Resource\Storage\StorageInterface;
  13. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  14. final class SessionStorage implements StorageInterface
  15. {
  16.     /** @var SessionInterface */
  17.     private $session;
  18.     public function __construct(SessionInterface $session)
  19.     {
  20.         $this->session $session;
  21.     }
  22.     public function has(string $name): bool
  23.     {
  24.         return $this->session->has($name);
  25.     }
  26.     public function get(string $name$default null)
  27.     {
  28.         return $this->session->get($name$default);
  29.     }
  30.     public function set(string $name$value): void
  31.     {
  32.         $this->session->set($name$value);
  33.     }
  34.     public function remove(string $name): void
  35.     {
  36.         $this->session->remove($name);
  37.     }
  38.     public function all(): array
  39.     {
  40.         return $this->session->all();
  41.     }
  42. }