Returns value of environment variable or default value
@param string $name
@param null $defaultValue
@return mixed value from env or defaultValue
14183
public static function getVar(string $name, $defaultValue = null)
    {
        $value = getenv($name);
        return $value !== false ? $value : $defaultValue;
    }
353886
public function getState($name,$defaultValue=null)
	{
		return isset($this->_state[$name])?$this->_state[$name]:$defaultValue;
	}
1092114
public function get( $name, $default = null )
	{
		$value = $this->_getObject()->get( $name, $default );

		$this->_file->set( $name, $value, $default );

		return $value;
	}
205573
public static String getEnvironmentString(String name, String defaultValue) {
        if (envVars == null) {
            throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentString.");
        }

        return envVars.get(ENV_PREFIX + name) != null ? envVars.get(ENV_PREFIX + name) : 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;
        }
    }
808763
protected function getDefaultValue($name, $value = null)
    {
        if ($value !== null)
            return $value;

        if ($this->model && $this->model->has($name))
            return $this->model->get($name);

        return $value;
    }
474213
public function getVariable($name, $default = null)
    {
        if (!array_key_exists($name, $this->variables)) {
            return $default;
        }
        return $this->variables[$name];
    }
295624
public static function get($name, $default = null, $options = self::VAR_STRING)
    {
        $envKey = trim($name);

        $value = getenv($envKey);
        if ($value === false) {
            if (isset($_ENV[$envKey])) {
                return self::convert($_ENV[$envKey], $options);
            }
            return $default;
        }

        return self::convert($value, $options);
    }
537777
public function getValue(string $key, $defaultValue = null)
    {
        if ($this->offsetExists($key)) {
            return $this->offsetGet($key);
        } else {
            return $defaultValue;
        }
    }
501793
public function value($name, $default = null)
    {
        if (! is_null($value = $this->valueFromOld($name))) {
            return $value;
        }

        if (! is_null($value = $this->valueFromModel($name))) {
            return $value;
        }
        return $default;
    }
1006279
public static function getBool( $name, $default = false ) {
		$var = getenv( $name );
		$val = filter_var( $var, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE );
		return ( $val === null ) ? $default : $val;
	}
1234693
protected function getParam($name, $defaultValue = null)
    {
        return $this->requestMethod == self::REQUEST_METHOD_GET ?
            Yii::$app->request->getQueryParam($name, $defaultValue) :
            Yii::$app->request->getBodyParam($name, $defaultValue);
    }
524737
public static function get(string $name, $default = null)
    {
        $value = getenv($name);

        if ($value === false) {
            return static::value($default);
        }

        switch (strtolower($value)) {
            case 'true':
            case '(true)':
                return true;

            case 'false':
            case '(false)':
                return false;

            case 'null':
            case '(null)':
                return null;
        }

        return static::sanitise($value);
    }
10005
public function getProperty($key, $defaultValue = null)
    {
        if (empty($this->properties[$key])) {
            return $defaultValue;
        }

        return $this->properties[$key];
    }
35679
public function getWithDefault($name, $default)
    {
        $value = NestedArrayUtil::getNestedArrayValue(self::$config, explode('.', $name), $exists);
        if (!$exists) {
            return $default;
        }

        return $value;
    }
1225768
public static function getVar(string $name, $default = null)
    {
        if (array_key_exists($name, $_ENV)) {
            return $_ENV[$name];
        } elseif (array_key_exists($name, $_SERVER)) {
            return $_SERVER[$name];
        } else {
            $value = getenv($name);

            if ($value === false) {
                return $default;
            }

            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;
    }