public static function defaultEnvironment($key = null, $merge = false) {
        if (self::$defaultEnv === null) {
            self::$defaultEnv = array(
                'REQUEST_METHOD' => 'GET',
                'X_REWRITE' => true,
                'SCRIPT_NAME' => '',
                'PATH_INFO' => '/',
                'EXT' => '',
                'QUERY' => [],
                'SERVER_NAME' => 'localhost',
                'SERVER_PORT' => 80,
                'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
                'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                'HTTP_USER_AGENT' => 'Garden/0.1 (Howdy stranger)',
                'REMOTE_ADDR' => '127.0.0.1',
                'URL_SCHEME' => 'http',
                'INPUT' => [],
            );
        }

        if ($key === null) {
            return self::$defaultEnv;
        } elseif (is_array($key)) {
            if ($merge) {
                self::$defaultEnv = array_merge(self::$defaultEnv, $key);
            } else {
                self::$defaultEnv = $key;
            }
            return self::$defaultEnv;
        } elseif (is_string($key)) {
            return val($key, self::$defaultEnv);
        } else {
            throw new \InvalidArgumentException("Argument #1 for Request::globalEnvironment() is invalid.", 422);
        }
    }
public static function defaultEnvironment($key = null, $merge = false) {
        if (self::$defaultEnv === null) {
            self::$defaultEnv = array(
                'REQUEST_METHOD' => 'GET',
                'X_REWRITE' => true,
                'SCRIPT_NAME' => '',
                'PATH_INFO' => '/',
                'EXT' => '',
                'QUERY' => [],
                'SERVER_NAME' => 'localhost',
                'SERVER_PORT' => 80,
                'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
                'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                'HTTP_USER_AGENT' => 'Garden/0.1 (Howdy stranger)',
                'REMOTE_ADDR' => '127.0.0.1',
                'URL_SCHEME' => 'http',
                'INPUT' => [],
            );
        }

        if ($key === null) {
            return self::$defaultEnv;
        } elseif (is_array($key)) {
            if ($merge) {
                self::$defaultEnv = array_merge(self::$defaultEnv, $key);
            } else {
                self::$defaultEnv = $key;
            }
            return self::$defaultEnv;
        } elseif (is_string($key)) {
            return val($key, self::$defaultEnv);
        } else {
            throw new \InvalidArgumentException("Argument #1 for Request::globalEnvironment() is invalid.", 422);
        }
    }
public static function defaultEnvironment ( $ key = null , $ merge = false ) { if ( self :: $ defaultEnv === null ) { self :: $ defaultEnv = array ( 'REQUEST_METHOD' => 'GET' , 'X_REWRITE' => true , 'SCRIPT_NAME' => '' , 'PATH_INFO' => '/' , 'EXT' => '' , 'QUERY' => [ ] , 'SERVER_NAME' => 'localhost' , 'SERVER_PORT' => 80 , 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' , 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8' , 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3' , 'HTTP_USER_AGENT' => 'Garden/0.1 (Howdy stranger)' , 'REMOTE_ADDR' => '127.0.0.1' , 'URL_SCHEME' => 'http' , 'INPUT' => [ ] , ) ; } if ( $ key === null ) { return self :: $ defaultEnv ; } elseif ( is_array ( $ key ) ) { if ( $ merge ) { self :: $ defaultEnv = array_merge ( self :: $ defaultEnv , $ key ) ; } else { self :: $ defaultEnv = $ key ; } return self :: $ defaultEnv ; } elseif ( is_string ( $ key ) ) { return val ( $ key , self :: $ defaultEnv ) ; } else { throw new \ InvalidArgumentException ( "Argument #1 for Request::globalEnvironment() is invalid." , 422 ) ; } }
Gets or updates the default environment.

@param string|array|null $key Specifies a specific key in the environment array.
If you pass an array for this parameter then you can set the default environment.
@param bool $merge Whether or not to merge the new value.
@return array|mixed Returns the value at {@link $key} or the entire environment array.
@throws \InvalidArgumentException Throws an exception when {@link $key} is not valid.
Gets or updates the default environment .