M6Web\Bundle\PhpProcessManagerBundle\Bridge\HttpKernel::mapResponse PHP Method

mapResponse() protected static method

Convert Symfony\Component\HttpFoundation\Response to React\Http\Response
protected static mapResponse ( React\Http\Response $reactResponse, Response $symfonyResponse )
$reactResponse React\Http\Response
$symfonyResponse Symfony\Component\HttpFoundation\Response
    protected static function mapResponse(ReactResponse $reactResponse, SymfonyResponse $symfonyResponse)
    {
        $headers = $symfonyResponse->headers->all();
        $reactResponse->writeHead($symfonyResponse->getStatusCode(), $headers);
        // @TODO convert StreamedResponse in an async manner
        if ($symfonyResponse instanceof SymfonyStreamedResponse) {
            ob_start();
            $symfonyResponse->sendContent();
            $content = ob_get_contents();
            ob_end_clean();
        } else {
            $content = $symfonyResponse->getContent();
        }
        $reactResponse->end($content);
    }