src/Request/SlimRequest.php
/**
     * Creates a new request object from the data of a reactPHP request object
     *
     * @param ReactRequest $request ReactPHP native request object
     * @param string       $body    Content of received call
     *
     * @return SlimPHPRequest
     */
Creates a new request object from the data of a reactPHP request object
@param ReactRequest $request ReactPHP native request object
@param string       $body    Content of received call


Creates a new request object from the data of a reactPHP request object @param ReactRequest $request ReactPHP native request object @param string $body Content of received call
static public function createFromReactRequest(ReactRequest $request, string $body = '') :SlimPHPRequest
    {
        $slimHeads = new SlimPHPHeaders();
        $cookies   = [];
        $host      = ['', 80];
        foreach($request->getHeaders() as $reactHeadKey => $reactHead) {
            $slimHeads->add($reactHeadKey, $reactHead);
            switch($reactHeadKey) {
                case 'Host':
                    $host = static::getHost($reactHead);
                    break;
                case 'Cookie':
                    $cookies = SlimPHPCookies::parseHeader($reactHead);
                    break;
            }
        }
        $slimUri = new SlimPHPUri(
            'http',
            $host[0],
            (int) $host[1],
            $request->getPath(),
            $request->getQuery()
        );
        $serverParams                    = $_SERVER;
        $serverParams['SERVER_PROTOCOL'] = 'HTTP/'.$request->getHttpVersion();
        $slimBody = static::getBody($body);
        return new SlimPHPRequest(
                $request->getMethod(),
                $slimUri,
                $slimHeads,
                $cookies,
                $serverParams,
                $slimBody
            );
    }
static public function createFromReactRequest ( ReactRequest $ request , string $ body = '' ) : SlimPHPRequest { $ slimHeads = new SlimPHPHeaders ( ) ; $ cookies = [ ] ; $ host = [ '' , 80 ] ; foreach ( $ request -> getHeaders ( ) as $ reactHeadKey => $ reactHead ) { $ slimHeads -> add ( $ reactHeadKey , $ reactHead ) ; switch ( $ reactHeadKey ) { case 'Host' : $ host = static :: getHost ( $ reactHead ) ; break ; case 'Cookie' : $ cookies = SlimPHPCookies :: parseHeader ( $ reactHead ) ; break ; } } $ slimUri = new SlimPHPUri ( 'http' , $ host [ 0 ] , ( int ) $ host [ 1 ] , $ request -> getPath ( ) , $ request -> getQuery ( ) ) ; $ serverParams = $ _SERVER ; $ serverParams [ 'SERVER_PROTOCOL' ] = 'HTTP/' . $ request -> getHttpVersion ( ) ; $ slimBody = static :: getBody ( $ body ) ; return new SlimPHPRequest ( $ request -> getMethod ( ) , $ slimUri , $ slimHeads , $ cookies , $ serverParams , $ slimBody ) ; }
Creates a new request object from the data of a reactPHP request object
 @param ReactRequest $request ReactPHP native request object
 @param string       $body    Content of received call
Creates a new request object from the data of a reactPHP request object @param ReactRequest $request ReactPHP native request object @param string $body Content of received call