返回Server的值

如果$name为空则返回所有Server的值
@param string $name = null 获取的变量名,如果该值为null则返回$_SERVER数组,默认为null
@param string $defaultValue = null 当获取变量失败的时候返回该值,默认该值为null
@return mixed
187918
public function getServer($name = null, $defaultValue = null)
    {
        if ($name === null) {
            return $_SERVER;
        }
        
        $value = (isset($_SERVER[$name])) ? $_SERVER[$name] : $defaultValue;
        return $value;
    }
631312
public function get($component, $name, $defaultValue = null)
    {
        $this->load();

        $propertyKey = sprintf('%s__%s', $component, $name);

        if (isset($this->properties[$propertyKey])) {
            return $this->properties[$propertyKey]->getValue();
        }

        return $defaultValue;
    }
1344477
public function getValueByName(string $name, $default = null)
    {
        if (isset($this->values[$name])) {
            return $this->parseType($this->values[$name]);
        }

        return $default;
    }
1076198
public static function get($name = null, $default = null)
    {
        $queryParams = app()->request->getQueryParams();

        if (is_null($name)) {
            return $queryParams;
        } elseif (isset($queryParams[$name])) {
            return $queryParams[$name];
        }

        return $default;
    }
236876
public String getParam(@NotNull final String name, String defaultValue) {
        String value = getParam(name);

        if (value == null) {
            return defaultValue;
        }

        return value;
    }
93203
public function getCookie($name = null, $defaultValue = null) 
    {
        if ($name === null) {
            return $_COOKIE;
        }
        return (isset($_COOKIE[$name])) ? $_COOKIE[$name] : $defaultValue;
    }
680400
public function getQuery(string $name, string $type = null, $default = null)
    {
        $value = $this->getUserData($this->uri->getQueries(), $name);

        if ($type) {
            $value = $this->validateType($value, $type, $default);
        }

        return $value;
    }
1261088
public function getSession($name = null, $defaultValue = null)
    {
        if ($name === null) {
            return $_SESSION;
        }
        return (isset($_SESSION[$name])) ? $_SESSION[$name] : $defaultValue;
    }
757765
public function getValue(string $name, $default = null)
    {
        if ($this->hasValue($name)) {
            return $this->data[$name];
        }

        return $default;
    }
775733
public String getHeader(@NotNull final String name, String defaultValue) {
        if (headers().contains(name)) {
            return getHeader(name);
        } else {
            return defaultValue;
        }
    }
325197
public function getParam($name, $default = null)
    {
        $value = array_get($this->params, $name);
        if ($value === null) {
            if ($default === null) {
                throw new InvalidValueException(['`:param` param is not exists in $configure->params', 'param' => $name]);
            } else {
                return $default;
            }
        } else {
            return $value;
        }
    }
1220079
private function getData($data, $name = null, $default = null)
    {
        if ($name == null) {
            return $data;
        }

        $value = $default;
        if (is_array($data) && array_key_exists($name, $data)) {
            $value = $data[$name];
        }

        return $value;
    }
455180
public function getRequestParameter($name, $defaultValue = null)
    {
        if (isset($_POST[$name])) {
            $value = $_POST[$name];
        } elseif (isset($_GET[$name])) {
            $value = $_GET[$name];
        } else {
            $value = $defaultValue;
        }

        return $value;
    }
203053
public function header($name = null, $default = null) {
        if (null === $name) {
            return $this->getHeader();
        }
        $key = 'HTTP_' . str_replace('-', '_', strtoupper($name));
        return $_SERVER[$key] ?? $default;
    }
309380
public function getServer($name, $default = null)
    {
        return isset($this->servers[$name]) ? $this->servers[$name] : $default;
    }
653633
public <R> R get(@NotNull final String name, R defaultValue) {
        if (context.containsKey(name)) {
            return get(name);
        } else {
            return defaultValue;
        }
    }
981337
public function getValue(string $name, $default = null)
    {
        $value = Arr::getByPath($this->config, $name, $default);

        if ($value && $value instanceof \Closure) {
            $value = $value();
        }

        return $value;
    }