public function setBag($name, SessionBagInterface $bag)
    {
        $this->bags[strtolower($name)] = $bag;

        if ($this->isActive()) {
            $this->prepareBagsData([$name => $bag]);
        }

        return $this;
    }
public function setBag($name, SessionBagInterface $bag)
    {
        $this->bags[strtolower($name)] = $bag;

        if ($this->isActive()) {
            $this->prepareBagsData([$name => $bag]);
        }

        return $this;
    }
public function setBag ( $ name , SessionBagInterface $ bag ) { $ this -> bags [ strtolower ( $ name ) ] = $ bag ; if ( $ this -> isActive ( ) ) { $ this -> prepareBagsData ( [ $ name => $ bag ] ) ; } return $ this ; }
Set session bag by name.

@param   string              $name Session bag name to set.
@param   SessionBagInterface $bag  Session bag object.

@return  static

@since   2.0
Set session bag by name .