php/commands/src/CLI_Alias_Command.php
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 );

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

	}
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 ) ; }
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.
Get config path and aliases data based on config type .