protected function mapRequest(ServerRequestInterface $psrRequest)
    {
        $method = $psrRequest->getMethod();
        $query = $psrRequest->getQueryParams();

        // cookies
        $_COOKIE = [];

        foreach ($psrRequest->getHeader('Cookie') as $cookieHeader) {
            $cookies = explode(';', $cookieHeader);

            foreach ($cookies as $cookie) {
                if (strpos($cookie, '=') == false) {
                    continue;
                }
                list($name, $value) = explode('=', trim($cookie));
                $_COOKIE[$name] = $value;

                if ($name === session_name()) {
                    session_id($value);
                }
            }
        }

        /** @var \React\Http\Io\UploadedFile $file */
        $uploadedFiles = $psrRequest->getUploadedFiles();

        $this->mapFiles($uploadedFiles);

        // @todo check howto handle additional headers
        // @todo check howto support other HTTP methods with bodies
        $post = $psrRequest->getParsedBody() ?: [];

        if ($this->bootstrap instanceof RequestClassProviderInterface) {
            $class = $this->bootstrap->requestClass();
        } else {
            $class = SymfonyRequest::class;
        }

        /** @var SymfonyRequest $syRequest */
        $syRequest = new $class($query, $post, $attributes = [], $_COOKIE, $uploadedFiles, $_SERVER, (string)$psrRequest->getBody());

        $syRequest->setMethod($method);

        if ($syRequest instanceof \Illuminate\Http\Request && $syRequest->isJson()) {
            $syRequest->request = $syRequest->json();
        }

        return $syRequest;
    }
protected function mapRequest(ServerRequestInterface $psrRequest)
    {
        $method = $psrRequest->getMethod();
        $query = $psrRequest->getQueryParams();

        // cookies
        $_COOKIE = [];

        foreach ($psrRequest->getHeader('Cookie') as $cookieHeader) {
            $cookies = explode(';', $cookieHeader);

            foreach ($cookies as $cookie) {
                if (strpos($cookie, '=') == false) {
                    continue;
                }
                list($name, $value) = explode('=', trim($cookie));
                $_COOKIE[$name] = $value;

                if ($name === session_name()) {
                    session_id($value);
                }
            }
        }

        /** @var \React\Http\Io\UploadedFile $file */
        $uploadedFiles = $psrRequest->getUploadedFiles();

        $this->mapFiles($uploadedFiles);

        // @todo check howto handle additional headers
        // @todo check howto support other HTTP methods with bodies
        $post = $psrRequest->getParsedBody() ?: [];

        if ($this->bootstrap instanceof RequestClassProviderInterface) {
            $class = $this->bootstrap->requestClass();
        } else {
            $class = SymfonyRequest::class;
        }

        /** @var SymfonyRequest $syRequest */
        $syRequest = new $class($query, $post, $attributes = [], $_COOKIE, $uploadedFiles, $_SERVER, (string)$psrRequest->getBody());

        $syRequest->setMethod($method);

        if ($syRequest instanceof \Illuminate\Http\Request && $syRequest->isJson()) {
            $syRequest->request = $syRequest->json();
        }

        return $syRequest;
    }
protected function mapRequest ( ServerRequestInterface $ psrRequest ) { $ method = $ psrRequest -> getMethod ( ) ; $ query = $ psrRequest -> getQueryParams ( ) ; // cookies $ _COOKIE = [ ] ; foreach ( $ psrRequest -> getHeader ( 'Cookie' ) as $ cookieHeader ) { $ cookies = explode ( ';' , $ cookieHeader ) ; foreach ( $ cookies as $ cookie ) { if ( strpos ( $ cookie , '=' ) == false ) { continue ; } list ( $ name , $ value ) = explode ( '=' , trim ( $ cookie ) ) ; $ _COOKIE [ $ name ] = $ value ; if ( $ name === session_name ( ) ) { session_id ( $ value ) ; } } } /** @var \React\Http\Io\UploadedFile $file */ $ uploadedFiles = $ psrRequest -> getUploadedFiles ( ) ; $ this -> mapFiles ( $ uploadedFiles ) ; // @todo check howto handle additional headers // @todo check howto support other HTTP methods with bodies $ post = $ psrRequest -> getParsedBody ( ) ? : [ ] ; if ( $ this -> bootstrap instanceof RequestClassProviderInterface ) { $ class = $ this -> bootstrap -> requestClass ( ) ; } else { $ class = SymfonyRequest :: class ; } /** @var SymfonyRequest $syRequest */ $ syRequest = new $ class ( $ query , $ post , $ attributes = [ ] , $ _COOKIE , $ uploadedFiles , $ _SERVER , ( string ) $ psrRequest -> getBody ( ) ) ; $ syRequest -> setMethod ( $ method ) ; if ( $ syRequest instanceof \ Illuminate \ Http \ Request && $ syRequest -> isJson ( ) ) { $ syRequest -> request = $ syRequest -> json ( ) ; } return $ syRequest ; }
Convert React\Http\Request to Symfony\Component\HttpFoundation\Request

@param ServerRequestInterface $psrRequest

@return SymfonyRequest $syRequest
Convert React \ Http \ Request to Symfony \ Component \ HttpFoundation \ Request