Get a config value.

@param $string

@throws \Exception

@return mixed
427677
protected function config($string, $default = null)
    {
        if (is_null(config($config = Constants::CONFIG_PACKAGE_NAME))) {
            throw new \Exception("Config ({$config}.php) not found. Have you published it?");
        }

        return config(
            implode('.', [Constants::CONFIG_PACKAGE_NAME, $string]),
            $default
        );
    }
808197
private function prepareString($string)
    {
        return str_replace(
            array_keys($this->owner->variables),
            array_values($this->owner->variables),
            $string
        );
    }
8348
public function getString($string)
    {
        // Exact match?
        if (isset($this->strings[$string])) {
            return $this->strings[$string];
        } else {
            return $string;
        }
    }
1080992
public function loadString($string)
    {
        $this->sourceString = $string;

        if ($this->config->allowPhpScripts === false) {
            $this->sourceString = preg_replace(
                '/<\\?.*(\\?>|$)/Us',
                '',
                str_replace('<?=', '<?php echo ', $this->sourceString)
            );
        }

        $this->sourceString = str_replace(
            [
                '__DIR__',
                '__FILE__',
            ],
            [
                "'" . $this->getSourceFileDirectory() . "'",
                "'" . $this->getSourceFilePath() . "'",
            ],
            $this->sourceString
        );

        return empty($this->sourceString);
    }
957584
public static function parseString($string)
    {
        $array = preg_split('/[,;\r\n]+/', trim($string, ",;\r\n"));
        if (strpos($string, ':')) {
            $value = [];
            foreach ($array as $val) {
                list($k, $v) = explode(':', $val);
                $value[$k] = $v;
            }
        } else {
            $value = $array;
        }
        
        return $value;
    }
436830
public static function at($string, $index)
    {
        if (self::length($string) >= ($index + 1)) {
            return $string[$index];
        }

        exception(StringOutIndexException::class);
    }
1077568
function _getValue($string)
	{
		if (preg_match('/value=("([^"]*)"|\'([^\']*)\'|[^>\s]*)([^>]*)?>/is', $string, $match)) {
			$val_match = trim($match[1]);
			$val_match = trim($val_match, '"\'');
			unset($string);
			return $val_match;
		}
		return false;
	}
899292
public function setGetfield($string)
    {
        if (!is_null($this->getPostfields())) 
        { 
            throw new Exception('You can only choose get OR post fields.'); 
        }
        
        $search = array('#', ',', '+', ':');
        $replace = array('%23', '%2C', '%2B', '%3A');
        $string = str_replace($search, $replace, $string);  
        
        $this->getfield = $string;
        
        return $this;
    }
371153
public function getValue($string)
    {
        // now just drop the msb and reorder it + parse it in own string
        $valuestring = '';
        $string_length = strlen($string);

        $i = 1;

        while ($string_length > $i) {
            // unset msb string and reorder it
            $valuestring = substr($string, $i, 7) . $valuestring;
            $i += 8;
        }

        // now interprete it
        return bindec($valuestring);
    }
1140792
public function get(string $path = null)
    {
        if (null === $path)
            return $this->data;
        $keys = explode('.', $path);
        $value = $this->data;
        foreach ($keys as $key) {
            if (!is_array($value) || !array_key_exists($key, $value))
                throw new \Exception("Unable to find a configuration value with path '{$path}'");
            $value = $value[$key];
        }
        return $value;
    }
594711
protected static function getUserDefinedVariableString(&$string)
    {
        $returnData = [
            Tokenizer::TOKEN_VALUE => null,
            Tokenizer::TOKEN_TYPE => Tokenizer::TOKEN_TYPE_VARIABLE,
        ];

        self::setTokenValueStartingWithAtSymbolAndWrapped($returnData, $string);
        self::setTokenValueStartingWithAtSymbol($returnData, $string);

        return $returnData;
    }
900526
protected function getConfigValue($name)
    {
        if (substr($name, 0, 1) != '/') {
            $name = '/' . $name;
        }
        $config = new JsonConfig(getcwd() . '/composer.json');
        $value  = $config->getConfigValue('/extra/contao' . $name);

        // Fallback to global config.
        if ($value === null) {
            /** @var JsonConfig $config */
            $config = $this->getApplication()->getConfig();
            if ($config !== null) {
                $value = $config->getConfigValue($name);
            }
        }

        return $value;
    }
465272
public static function getConfigValue( $config, $key, $default = NULL )
	{
		if( !isset( $config[$key] ) )
			return $default;
		$value	= trim( $config[$key] );
		if( preg_match( '/^[A-Z_]+$/', $value ) )
			$value	= constant( $value );
		else if( preg_match( '/^[0-9]+$/', $value ) )
			$value	= (int) $value;
		else if( preg_match( '/^[0-9.]+$/', $value ) )
			$value	= (real) $value;
		else if( empty( $value ) )
			return $default;
		return $value;
	}
1069236
private function getValue ($key)
    {
        return isset($this->configuration[$key])
            ? $this->configuration[$key]
            : null;
    }
976794
public function get($key)
    {
        expect_type($key, 'string');

        $value = DotKey::on($this)->get($key);

        if (!isset($value)) {
            throw new NotFoundException("Config setting '$key' not found");
        }

        return $value;
    }
1335629
protected function getStringQueryParameters($string)
    {
        $query = parse_url($string, PHP_URL_QUERY);

        $params = [];
        if ($query) parse_str($query, $params);

        return $params;
    }
1233067
public function get(string $key)
    {
        $key = strtolower($key);

        if (empty($this->configuration[$key])) {
            $this->loadConfigFile($key);
        }

        return $this->configuration[$key];
    }