src/Service/My_session.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Service;
  3. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  4. class My_session
  5. {
  6.     private $session;
  7.     public function __construct(SessionInterface $session)
  8.     {
  9.         $this->session $session;
  10.     }
  11.     public function set($key,$value)
  12.     {
  13.         $this->session->set($key$value);
  14.     }
  15.     public function get($key)
  16.     {
  17.         if(!empty($this->session->get($key))){
  18.             return $this->session->get($key);
  19.         }
  20.     }
  21.     public function remove($key)
  22.     {
  23.         if(!empty($this->session->get($key))){
  24.             return $this->session->remove($key);
  25.         }
  26.     }
  27.     public function clear()
  28.     {
  29.         return $this->session->clear();
  30.     }
  31. }