Get config path and aliases data based on config type.

@param string $config Type of config to get data from.
@param string $alias  Alias to be used for Add/Update/Delete.

@return array Config Path and Aliases in it.
480616
private function get_aliases_data( $config, $alias ) {

		$global_config_path = WP_CLI::get_runner()->get_global_config_path();
		$global_aliases     = Spyc::YAMLLoad( $global_config_path );

		$project_config_path = WP_CLI::get_runner()->get_project_config_path();
		$project_aliases     = Spyc::YAMLLoad( $project_config_path );

		if ( 'global' === $config ) {
			$config_path = $global_config_path;
			$aliases     = $global_aliases;
		} elseif ( 'project' === $config ) {
			$config_path = $project_config_path;
			$aliases     = $project_aliases;
		} else {

			$is_global_alias  = array_key_exists( $alias, $global_aliases );
			$is_project_alias = array_key_exists( $alias, $project_aliases );

			if ( $is_global_alias && $is_project_alias ) {
				WP_CLI::error( "Key '{$alias}' found in more than one path. Please pass --config param." );
			} elseif ( $is_global_alias ) {
				$config_path = $global_config_path;
				$aliases     = $global_aliases;
			} else {
				$config_path = $project_config_path;
				$aliases     = $project_aliases;
			}
		}

		return array( $config_path, $aliases );

	}
283927
public function getAlias($alias) {
		if (!is_string($alias)) {
			return $alias;
		}

		if (array_key_exists($alias, $this->aliases)) {
			return $this->aliases[$alias];
		}

		return $alias;
	}
788538
private function getSiteId($config)
    {
        $result = $this->siteId;
        if ($this->useSiteId) {
            $result = $config->get(Option::SITE_ID);
        }

        return $result;
    }
1035135
protected function getDsn(array $config)
    {
        return $this->hasDsnString($config) ? $this->getDsnString($config) : $this->getHostDsn($config);
    }
816044
protected function getOptionsFromConfig(Config $config)
    {
        $options = $this->options;
        foreach (static::$mappingOptions as $option => $ossOption) {
            if (! $config->has($option)) {
                continue;
            }
            $options[$ossOption] = $config->get($option);
        }

        return $options;
    }
1328743
public static function alias(&$config, $key, $alias){
		if(!isset($config[$alias]))
			return;
		$tmp = & $config;
		foreach(explode('.', $key) as $key){
			$tmp = & $tmp[$key];
		}
		if(!isset($tmp))
			$tmp = $config[$alias];
	}
1277758
public function get_option($config = '') {
        global $DB;
        $cache = cache::make('core', 'repositories');
        if (($entries = $cache->get('ops:'. $this->id)) === false) {
            $entries = $DB->get_records('repository_instance_config', array('instanceid' => $this->id));
            $cache->set('ops:'. $this->id, $entries);
        }

        $ret = array();
        foreach($entries as $entry) {
            $ret[$entry->name] = $entry->value;
        }

        if (!empty($config)) {
            if (isset($ret[$config])) {
                return $ret[$config];
            } else {
                return null;
            }
        } else {
            return $ret;
        }
    }
746707
protected function getOptionsFromConfig(Config $config)
    {
        $options = [];

        if ($config->has('visibility')) {
            switch (true) {
                case $config->get('visibility') === AdapterInterface::VISIBILITY_PUBLIC:
                    $options['predefinedAcl'] = static::GCS_VISIBILITY_PUBLIC_READ;
                    break;
                case $config->get('visibility') === AdapterInterface::VISIBILITY_PRIVATE:
                default:
                    $options['predefinedAcl'] = static::GCS_VISIBILITY_PROJECT_PRIVATE;
                    break;
            }
        }

        return $options;
    }
1147359
private function config_path($path = '')
    {
        return function_exists('config_path') ? config_path($path) : app()->basePath() . DIRECTORY_SEPARATOR . 'config' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
    }
1081136
public function exists($alias, $config = array())
	{
		$tableName = $this->cache->parseField($this->tableName);
		$key = $this->cache->parseField('key');
		return 0 < $this->cache->queryValue(<<<SQL
select 1 from {$tableName} where {$key} = %s
SQL
,array($alias));
	}
149916
private function massageConfig(array $config, string $configPath) : array
    {
        if (!isset($config['installed_paths'])) {
            return $config;
        }

        $config['installed_paths'] = implode(',', array_map(function ($path) use ($configPath) {
            return dirname($configPath) . '/' . $path;
        }, explode(',', $config['installed_paths'])));

        return $config;
    }
211642
static function get($alias = null)
    {
        if ($alias === null) {
            return static::$config[static::$default];
        }
        if (isset(static::$config[$alias])) {
            return static::$config[$alias];
        } else {
            return false;
        }
    }
963119
public static function config($config = null)
	{
		if(is_array($config)) {

            # Setting Configurations
			static::$config = $config + static::$config;
			$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
			static::$config['directory'] = $pathWithoutTrailingSlash.'/';

		} elseif(is_string($config)) {

            # Getting Single Config item
			return isset(static::$config[$config]) ? static::$config[$config] : null;

		} elseif(!$config) {

            # Getting All configurations
			return static::$config;
		} else {
			throw new CacheException('Invalid parameter provided for Cache::config()');
		}
	}
34683
public function exists($alias, $config = array())
	{
		return false !== $this->cache->get($alias,isset($config['cache_cb']) ? $config['cache_cb'] : null,isset($config['cas_token']) ? $config['cas_token'] : null);
	}
216512
public function path($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'root'  => JPATH_ROOT,
        ));

        return parent::path($config);
    }
964180
public function generateFilePath($config)
    {
        $key = $this->generateKey($config);
        return $this->generateDirectoryPath($config) . '/' . $key . '.ser';
    }
1097158
public function getOptions(array $config)
    {
        $options = array_get($config, 'options', array());

        return array_diff_key($this->options, $options) + $options;
    }