original_string: public function engine($class = null, array $options = [])
      {
          if ($class === null) {
              return $this->_engine;
          }
          if ($class instanceof SessionHandlerInterface) {
              return $this->setEngine($class);
          }
          $className = App::className($class, 'Http/Session');
  
          if (!$className) {
              $className = App::className($class, 'Network/Session');
              if ($className) {
                  deprecationWarning('Session adapters should be moved to the Http/Session namespace.');
              }
          }
          if (!$className) {
              throw new InvalidArgumentException(
                  sprintf('The class "%s" does not exist and cannot be used as a session engine', $class)
              );
          }
  
          $handler = new $className($options);
          if (!($handler instanceof SessionHandlerInterface)) {
              throw new InvalidArgumentException(
                  'The chosen SessionHandler does not implement SessionHandlerInterface, it cannot be used as an engine.'
              );
          }
  
          return $this->setEngine($handler);
      }
code: public function engine($class = null, array $options = [])
      {
          if ($class === null) {
              return $this->_engine;
          }
          if ($class instanceof SessionHandlerInterface) {
              return $this->setEngine($class);
          }
          $className = App::className($class, 'Http/Session');
  
          if (!$className) {
              $className = App::className($class, 'Network/Session');
              if ($className) {
                  deprecationWarning('Session adapters should be moved to the Http/Session namespace.');
              }
          }
          if (!$className) {
              throw new InvalidArgumentException(
                  sprintf('The class "%s" does not exist and cannot be used as a session engine', $class)
              );
          }
  
          $handler = new $className($options);
          if (!($handler instanceof SessionHandlerInterface)) {
              throw new InvalidArgumentException(
                  'The chosen SessionHandler does not implement SessionHandlerInterface, it cannot be used as an engine.'
              );
          }
  
          return $this->setEngine($handler);
      }
code_tokens: public function engine ( $ class = null , array $ options = [ ] ) { if ( $ class === null ) { return $ this -> _engine ; } if ( $ class instanceof SessionHandlerInterface ) { return $ this -> setEngine ( $ class ) ; } $ className = App :: className ( $ class , 'Http/Session' ) ; if ( ! $ className ) { $ className = App :: className ( $ class , 'Network/Session' ) ; if ( $ className ) { deprecationWarning ( 'Session adapters should be moved to the Http/Session namespace.' ) ; } } if ( ! $ className ) { throw new InvalidArgumentException ( sprintf ( 'The class "%s" does not exist and cannot be used as a session engine' , $ class ) ) ; } $ handler = new $ className ( $ options ) ; if ( ! ( $ handler instanceof SessionHandlerInterface ) ) { throw new InvalidArgumentException ( 'The chosen SessionHandler does not implement SessionHandlerInterface, it cannot be used as an engine.' ) ; } return $ this -> setEngine ( $ handler ) ; }
docstring: Sets the session handler instance to use for this session.
  If a string is passed for the first argument, it will be treated as the
  class name and the second argument will be passed as the first argument
  in the constructor.
  
  If an instance of a SessionHandlerInterface is provided as the first argument,
  the handler will be set to it.
  
  If no arguments are passed it will return the currently configured handler instance
  or null if none exists.
  
  @param string|\SessionHandlerInterface|null $class The session handler to use
  @param array $options the options to pass to the SessionHandler constructor
  @return \SessionHandlerInterface|null
  @throws \InvalidArgumentException
docstring_tokens: Sets the session handler instance to use for this session . If a string is passed for the first argument it will be treated as the class name and the second argument will be passed as the first argument in the constructor .