public static function createFromGlobals(): Request
    {
        // Create a new request from the PHP globals
        /** @var Request $request */
        $request = new static($_GET, $_POST, [], $_COOKIE, $_FILES, $_SERVER);

        if (
            0 === strpos(
                $request->headers()->get('Content-Type'),
                'application/x-www-form-urlencoded'
            )
            &&
            \in_array(
                strtoupper(
                    $request->server()->get(
                        'REQUEST_METHOD',
                        RequestMethod::GET
                    )
                ),
                [
                    RequestMethod::PUT,
                    RequestMethod::DELETE,
                    RequestMethod::PATCH,
                ],
                true
            )
        ) {
            parse_str($request->getContent(), $data);
            $request->request = new Collection($data);
        }

        return $request;
    }
public static function createFromGlobals(): Request
    {
        // Create a new request from the PHP globals
        /** @var Request $request */
        $request = new static($_GET, $_POST, [], $_COOKIE, $_FILES, $_SERVER);

        if (
            0 === strpos(
                $request->headers()->get('Content-Type'),
                'application/x-www-form-urlencoded'
            )
            &&
            \in_array(
                strtoupper(
                    $request->server()->get(
                        'REQUEST_METHOD',
                        RequestMethod::GET
                    )
                ),
                [
                    RequestMethod::PUT,
                    RequestMethod::DELETE,
                    RequestMethod::PATCH,
                ],
                true
            )
        ) {
            parse_str($request->getContent(), $data);
            $request->request = new Collection($data);
        }

        return $request;
    }
public static function createFromGlobals ( ) : Request { // Create a new request from the PHP globals /** @var Request $request */ $ request = new static ( $ _GET , $ _POST , [ ] , $ _COOKIE , $ _FILES , $ _SERVER ) ; if ( 0 === strpos ( $ request -> headers ( ) -> get ( 'Content-Type' ) , 'application/x-www-form-urlencoded' ) && \ in_array ( strtoupper ( $ request -> server ( ) -> get ( 'REQUEST_METHOD' , RequestMethod :: GET ) ) , [ RequestMethod :: PUT , RequestMethod :: DELETE , RequestMethod :: PATCH , ] , true ) ) { parse_str ( $ request -> getContent ( ) , $ data ) ; $ request -> request = new Collection ( $ data ) ; } return $ request ; }
Creates a new request with values from PHP super globals.

@return \Valkyrja\Http\Request
Creates a new request with values from PHP super globals .