protected function setEngine(SessionHandlerInterface $handler)
    {
        if (!headers_sent() && session_status() !== \PHP_SESSION_ACTIVE) {
            session_set_save_handler($handler, false);
        }

        return $this->_engine = $handler;
    }