vendor/craue/formflow-bundle/Storage/SessionStorage.php line 39

Open in your IDE?
  1. <?php
  2. namespace Craue\FormFlowBundle\Storage;
  3. use Craue\FormFlowBundle\Exception\InvalidTypeException;
  4. use Symfony\Component\HttpFoundation\RequestStack;
  5. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  6. /**
  7.  * Stores data in the session.
  8.  *
  9.  * @author Toni Uebernickel <tuebernickel@gmail.com>
  10.  * @copyright 2011-2022 Christian Raue
  11.  * @license http://opensource.org/licenses/mit-license.php MIT License
  12.  */
  13. class SessionStorage implements StorageInterface {
  14.     use SessionProviderTrait;
  15.     /**
  16.      * @param RequestStack|SessionInterface $requestStackOrSession
  17.      * @throws InvalidTypeException
  18.      */
  19.     public function __construct($requestStackOrSession) {
  20.         $this->setRequestStackOrSession($requestStackOrSession);
  21.     }
  22.     /**
  23.      * {@inheritDoc}
  24.      */
  25.     public function set($key$value) {
  26.         $this->getSession()->set($key$value);
  27.     }
  28.     /**
  29.      * {@inheritDoc}
  30.      */
  31.     public function get($key$default null) {
  32.         return $this->getSession()->get($key$default);
  33.     }
  34.     /**
  35.      * {@inheritDoc}
  36.      */
  37.     public function has($key) {
  38.         return $this->getSession()->has($key);
  39.     }
  40.     /**
  41.      * {@inheritDoc}
  42.      */
  43.     public function remove($key) {
  44.         $this->getSession()->remove($key);
  45.     }
  46. }