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

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.     /**
  23.      * {@inheritdoc}
  24.      */
  25.     public function has(string $name): bool
  26.     {
  27.         return $this->session->has($name);
  28.     }
  29.     /**
  30.      * {@inheritdoc}
  31.      */
  32.     public function get(string $name$default null)
  33.     {
  34.         return $this->session->get($name$default);
  35.     }
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function set(string $name$value): void
  40.     {
  41.         $this->session->set($name$value);
  42.     }
  43.     /**
  44.      * {@inheritdoc}
  45.      */
  46.     public function remove(string $name): void
  47.     {
  48.         $this->session->remove($name);
  49.     }
  50.     /**
  51.      * {@inheritdoc}
  52.      */
  53.     public function all(): array
  54.     {
  55.         return $this->session->all();
  56.     }
  57. }