public static function getRequest(): Request
    {
        $serverArr = $_SERVER;

        if ('cli' === PHP_SAPI) {
            // If we're running off the CLI, we're going to set some default
            // settings.
            $serverArr['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ?? '/';
            $serverArr['REQUEST_METHOD'] = $_SERVER['REQUEST_METHOD'] ?? 'CLI';
        }

        $r = self::createFromServerArray($serverArr);
        $r->setBody(fopen('php://input', 'r'));
        $r->setPostData($_POST);

        return $r;
    }
public static function getRequest(): Request
    {
        $serverArr = $_SERVER;

        if ('cli' === PHP_SAPI) {
            // If we're running off the CLI, we're going to set some default
            // settings.
            $serverArr['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ?? '/';
            $serverArr['REQUEST_METHOD'] = $_SERVER['REQUEST_METHOD'] ?? 'CLI';
        }

        $r = self::createFromServerArray($serverArr);
        $r->setBody(fopen('php://input', 'r'));
        $r->setPostData($_POST);

        return $r;
    }
public static function getRequest ( ) : Request { $ serverArr = $ _SERVER ; if ( 'cli' === PHP_SAPI ) { // If we're running off the CLI, we're going to set some default // settings. $ serverArr [ 'REQUEST_URI' ] = $ _SERVER [ 'REQUEST_URI' ] ?? '/' ; $ serverArr [ 'REQUEST_METHOD' ] = $ _SERVER [ 'REQUEST_METHOD' ] ?? 'CLI' ; } $ r = self :: createFromServerArray ( $ serverArr ) ; $ r -> setBody ( fopen ( 'php://input' , 'r' ) ) ; $ r -> setPostData ( $ _POST ) ; return $ r ; }
This static method will create a new Request object, based on the
current PHP request.
This static method will create a new Request object based on the current PHP request .