src/Request.php
/**
     * Creates a new request object from the data of a reactPHP request object
     *
     * @param ReactRequest $request ReactPHP native request object
     *
     * @return self
     */
Creates a new request object from the data of a reactPHP request object
@param ReactRequest $request ReactPHP native request object

@return self
Creates a new request object from the data of a reactPHP request object @param ReactRequest $request ReactPHP native request object @return self
static public function createFromReactRequest(ReactRequest $request) :self
    {
        $slimHeads = new SlimPHPHeaders();
        foreach($request->getHeaders() as $reactHeadKey => $reactHead) {
            $slimHeads->add($reactHeadKey, $reactHead);
            if($reactHeadKey === 'Host') {
                $host = explode(':', $reactHead);
                if(count($host) === 1) {
                    $host[1] = '80';
                }
            }
        }
        $slimUri = new SlimPHPUri(
            'http',
            $host[0],
            (int) $host[1],
            $request->getPath(),
            $request->getQuery()
        );
        $cookies = [];
        $serverParams = $_SERVER;
        $serverParams['SERVER_PROTOCOL'] = 'HTTP/'.$request->getHttpVersion();
        $slimBody = new SlimPHPRequestBody();
        return new self(
            $request->getMethod(),
            $slimUri,
            $slimHeads,
            $cookies,
            $serverParams,
            $slimBody
        );
    }
static public function createFromReactRequest ( ReactRequest $ request ) : self { $ slimHeads = new SlimPHPHeaders ( ) ; foreach ( $ request -> getHeaders ( ) as $ reactHeadKey => $ reactHead ) { $ slimHeads -> add ( $ reactHeadKey , $ reactHead ) ; if ( $ reactHeadKey === 'Host' ) { $ host = explode ( ':' , $ reactHead ) ; if ( count ( $ host ) === 1 ) { $ host [ 1 ] = '80' ; } } } $ slimUri = new SlimPHPUri ( 'http' , $ host [ 0 ] , ( int ) $ host [ 1 ] , $ request -> getPath ( ) , $ request -> getQuery ( ) ) ; $ cookies = [ ] ; $ serverParams = $ _SERVER ; $ serverParams [ 'SERVER_PROTOCOL' ] = 'HTTP/' . $ request -> getHttpVersion ( ) ; $ slimBody = new SlimPHPRequestBody ( ) ; return new self ( $ 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
Creates a new request object from the data of a reactPHP request object @param ReactRequest $request ReactPHP native request object