public static function create($method, $path, array $env = array())
    {
        $request = new self($method, $path);

        if (function_exists('getallheaders')) {
            $request->headers = getallheaders();
        } else {
            // TODO: filter array keys by their prefix, consider adding an extension function for this.
            $request->headers = self::createHeadersFromServerGlobal($env);
        }

        if (isset($env['_SERVER'])) {
            $request->serverParameters = $env['_SERVER'];
        } else {
            $request->serverParameters = $env;
        }
        $request->parameters = isset($env['_REQUEST']) ? $env['_REQUEST'] : array();
        $request->queryParameters = isset($env['_GET']) ? $env['_GET'] : array();
        $request->bodyParameters = isset($env['_POST']) ? $env['_POST'] : array();
        $request->cookieParameters = isset($env['_COOKIE']) ? $env['_COOKIE'] : array();
        $request->sessionParameters = isset($env['_SESSION']) ? $env['_SESSION'] : array();

        return $request;
    }
public static function create($method, $path, array $env = array())
    {
        $request = new self($method, $path);

        if (function_exists('getallheaders')) {
            $request->headers = getallheaders();
        } else {
            // TODO: filter array keys by their prefix, consider adding an extension function for this.
            $request->headers = self::createHeadersFromServerGlobal($env);
        }

        if (isset($env['_SERVER'])) {
            $request->serverParameters = $env['_SERVER'];
        } else {
            $request->serverParameters = $env;
        }
        $request->parameters = isset($env['_REQUEST']) ? $env['_REQUEST'] : array();
        $request->queryParameters = isset($env['_GET']) ? $env['_GET'] : array();
        $request->bodyParameters = isset($env['_POST']) ? $env['_POST'] : array();
        $request->cookieParameters = isset($env['_COOKIE']) ? $env['_COOKIE'] : array();
        $request->sessionParameters = isset($env['_SESSION']) ? $env['_SESSION'] : array();

        return $request;
    }
public static function create ( $ method , $ path , array $ env = array ( ) ) { $ request = new self ( $ method , $ path ) ; if ( function_exists ( 'getallheaders' ) ) { $ request -> headers = getallheaders ( ) ; } else { // TODO: filter array keys by their prefix, consider adding an extension function for this. $ request -> headers = self :: createHeadersFromServerGlobal ( $ env ) ; } if ( isset ( $ env [ '_SERVER' ] ) ) { $ request -> serverParameters = $ env [ '_SERVER' ] ; } else { $ request -> serverParameters = $ env ; } $ request -> parameters = isset ( $ env [ '_REQUEST' ] ) ? $ env [ '_REQUEST' ] : array ( ) ; $ request -> queryParameters = isset ( $ env [ '_GET' ] ) ? $ env [ '_GET' ] : array ( ) ; $ request -> bodyParameters = isset ( $ env [ '_POST' ] ) ? $ env [ '_POST' ] : array ( ) ; $ request -> cookieParameters = isset ( $ env [ '_COOKIE' ] ) ? $ env [ '_COOKIE' ] : array ( ) ; $ request -> sessionParameters = isset ( $ env [ '_SESSION' ] ) ? $ env [ '_SESSION' ] : array ( ) ; return $ request ; }
A helper function for creating request object based on request method and request uri.

@param string $method
@param string $path
@param array  $headers The headers will be built on $_SERVER if the argument is null.

@return RouteRequest
A helper function for creating request object based on request method and request uri .