private function dispatchRequest(int $requestId): int
    {
        $request = new Request(
            $this->requests[$requestId]['params'],
            $this->requests[$requestId]['stdin']
        );

        try {
            $response = $this->kernel->handleRequest($request);
        } finally {
            $request->cleanUploadedFiles();
        }

        if ($response instanceof ResponseInterface) {
            $this->sendResponse($requestId, $response);
        } elseif ($response instanceof HttpFoundationResponse) {
            $this->sendHttpFoundationResponse($requestId, $response);
        } else {
            throw new \LogicException('Kernel must return a PSR-7 or HttpFoundation response message');
        }

        $this->endRequest($requestId);

        // This method exists on PSR-7 and Symfony responses
        return $response->getStatusCode();
    }
private function dispatchRequest(int $requestId): int
    {
        $request = new Request(
            $this->requests[$requestId]['params'],
            $this->requests[$requestId]['stdin']
        );

        try {
            $response = $this->kernel->handleRequest($request);
        } finally {
            $request->cleanUploadedFiles();
        }

        if ($response instanceof ResponseInterface) {
            $this->sendResponse($requestId, $response);
        } elseif ($response instanceof HttpFoundationResponse) {
            $this->sendHttpFoundationResponse($requestId, $response);
        } else {
            throw new \LogicException('Kernel must return a PSR-7 or HttpFoundation response message');
        }

        $this->endRequest($requestId);

        // This method exists on PSR-7 and Symfony responses
        return $response->getStatusCode();
    }
private function dispatchRequest ( int $ requestId ) : int { $ request = new Request ( $ this -> requests [ $ requestId ] [ 'params' ] , $ this -> requests [ $ requestId ] [ 'stdin' ] ) ; try { $ response = $ this -> kernel -> handleRequest ( $ request ) ; } finally { $ request -> cleanUploadedFiles ( ) ; } if ( $ response instanceof ResponseInterface ) { $ this -> sendResponse ( $ requestId , $ response ) ; } elseif ( $ response instanceof HttpFoundationResponse ) { $ this -> sendHttpFoundationResponse ( $ requestId , $ response ) ; } else { throw new \ LogicException ( 'Kernel must return a PSR-7 or HttpFoundation response message' ) ; } $ this -> endRequest ( $ requestId ) ; // This method exists on PSR-7 and Symfony responses return $ response -> getStatusCode ( ) ; }
Dispatches a request to the kernel.

@param int $requestId The request id that is ready to dispatch

@return int status code from the response.

@throws \LogicException If the kernel doesn't return a valid response
Dispatches a request to the kernel .