Get config considering the API name if present.

@param string $cfg Config path
@param string $name Name of api if present

@return mixed The result of the config
504143
protected function getConfig($cfg, $name = null)
    {
        if (is_null($name)) {
            $name = $this->apiName;
        }

        $name = $name ? ".$name" : '';

        return config("api.$cfg{$name}");
    }
1056155
private function _get($cfg/*, ... */) {
        $args = array_slice(func_get_args(), 1);
        if (count($args) === 0)
            return $cfg;
        else {
            if (!is_array($cfg) || !$this->has($args[0], $cfg))
                throw new NotFoundSettingsException($args[0]);
            $args[0] = $cfg[$args[0]];
            return call_user_func_array(array($this, "_get"), $args);
        }
    }
316407
protected function loadConfiguration(Structure $config, $name = null)
    {
        $name = $name ?: $this->getName();

        // Load library config
        $configName = $this->isWeb() ? 'web' : 'console';

        $config->loadFile(__DIR__ . '/../../config/' . $configName . '.php', 'php', ['load_raw' => true]);

        // Load application config
        $file = $this->rootPath . '/etc/app/' . $name . '.php';

        if (is_file($file)) {
            $config->loadFile($file, 'php', ['load_raw' => true]);
        }

        $configs = (array) $config->get('configs', []);

        ksort($configs);

        foreach ($configs as $file) {
            if ($file === false || !is_file($file)) {
                continue;
            }

            $config->loadFile($file, pathinfo($file, PATHINFO_EXTENSION), ['load_raw' => true]);
        }

        $this->container->setParameters($config);
    }
531546
public function get(string $name, $default = null)
    {
        if (!isset($this->configs[$name])) {
            $this->set($name, $default);
        }
        return $this->configs[$name];
    }
1023005
public static function getInstance($cfg = array())
    {
        if (!isset(self::$instance)) {
            $className = __CLASS__;
            // self::$instance set in __construct
            new $className($cfg);
        } elseif ($cfg) {
            self::$instance->setCfg($cfg);
        }
        return self::$instance;
    }
754636
public function projectConfig($name)
    {
        if (isset($this->projectConfig)) {
            return $this->projectConfig->get($name);
        } else {
            return null;
        }
    }
396919
protected function _get($name)
    {
        $config = $this->option($name);
        list($key, $extra) = $this->_splitOptionName($name);

        if ($extra === '' && $config['group']) {
            $result = [];
            if (!isset($this->_values[$key])) {
                return $result;
            }
            foreach ($this->_values[$key] as $extra => $value) {
                $result[$extra] = $this->_get($name . ':' . $extra);
            }
            return $result;
        } else {
            $value = isset($this->_values[$key][$extra]) ? $this->_values[$key][$extra] : $config['default'];
        }

        $casted = $this->cast($value, $config['type'], $config['array']);
        if (!isset($config['value'])) {
            return $casted;
        }
        if (is_callable($config['value'])) {
            return array_key_exists($key, $this->_values) ? $config['value']($casted, $name, $this) : $casted;
        }
        return $config['value'];
    }
589458
public function getConfig(string $name = null)
    {
        return (null !== $name)
            ? $this->_config->get($name)
            : $this->_config;
    }
628001
public function getConfigFromFile($group, $name)
    {
        // Do we have a value in the ini?
        // Does it validate?
        if (isset($this->iniSettings[$group][$name]) === true &&
            $this->security->evaluateSetting($group, $name, $this->iniSettings[$group][$name]) === true
        ) {
            return $this->iniSettings[$group][$name];
        }

        return null;
    }
455561
public static function getInstance($name, $config = array())
    {
        static $instance;

        if (!$instance) {
            $instance = new static();
        }

        $object = clone $instance;

        $config['name'] = $name;

        $object->append($config)
        ->append(array(
            'attribs' => array(
            'id' => null,
            ),
        ));

        return $object;
    }
530232
public function get($name)
    {
        $item = $this->getItemPath($name);

        return $this->config->get($item);
    }
130344
final protected function getConfigs($config = null)
    {
        if (null !== $config) {
            if (array_key_exists($config, self::$_configs)) {
                return self::$_configs[$config];
            } else {
                return false;
            }
        }

        return self::$_configs;
    }
498666
public function getConfigParam($name)
    {
        $result = null;
        $config = $this->getConfiguration();
        $parts  = explode('.', $name);
        foreach ($parts as $key) {
            if (isset($config[$key])) {
                $result = $config = $config[$key];
            } else {
                $result = null;
                break;
            }
        }
        return $result;
    }
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;
    }
350501
public function getConfig(string $name)
	{
		if (isset($this->store[$name])) {
			return $this->store[$name];
		}
		return null;
	}
1213483
public function getConfig($name, $default = false)
    {
        foreach ($this->configs as $config) {
            if ($config->getName() == $name) {
                return $config->getValue();
            }
        }

        return $default;
    }
818040
public function getConfig($name)
    {
        $setting = $this->settings;
        return isset($setting[$name]) ? $setting[$name] : null;
    }