CLI_Alias_Command::process_aliases()privateWP-CLI 1.0

Save aliases data to config file.

Method of the class: CLI_Alias_Command{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->process_aliases( $aliases, $alias, $config_path, $operation );
$aliases(array) (required)
Current aliases data.
$alias(string) (required)
Name of alias.
$config_path(string) (required)
Path to config file.
$operation(string)
Current operation string fro message.
Default: ''

CLI_Alias_Command::process_aliases() code WP-CLI 2.7.0-alpha

private function process_aliases( $aliases, $alias, $config_path, $operation = '' ) {
	// Convert data to YAML string.
	$yaml_data = Spyc::YAMLDump( $aliases );

	// Add data in config file.
	if ( file_put_contents( $config_path, $yaml_data ) ) {
		WP_CLI::success( "$operation '{$alias}' alias." );
	}
}