Autarky\Http\SessionMiddleware::handle PHP Метод

handle() публичный Метод

public handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
$request Symfony\Component\HttpFoundation\Request
    public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
    {
        // always set the session onto the request object.
        $request->setSession($this->session);
        // we only need to manage the session for the master request.
        // subrequests will have the session available anyways, but we will
        // be closing and setting the cookie for the master request only.
        if ($type !== HttpKernelInterface::MASTER_REQUEST) {
            return $this->kernel->handle($request, $type, $catch);
        }
        // the session may have been manually started before the middleware is
        // invoked - in this case, we cross our fingers and hope the session has
        // properly initialised itself
        if (!$this->session->isStarted()) {
            $this->initSession($request);
        }
        $response = $this->kernel->handle($request, $type, $catch);
        // if the session has started, save it and attach the session cookie. if
        // the session has not started, there is nothing to save and there is no
        // point in attaching a cookie to persist it.
        if ($this->session->isStarted()) {
            $this->closeSession($request, $response);
        }
        return $response;
    }