PHP Class WP_CLI\Configurator

Show file Open project: wp-cli/wp-cli Class Usage Examples

Public Methods

Method Description
__construct ( string $path )
extract_assoc ( $arguments ) : array(array) Splits positional args from associative args.
get_aliases ( ) : array Get any aliases defined in config files.
get_spec ( ) : array Get configuration specification, i.e. list of accepted keys.
merge_array ( array $config ) Merge an array of values into the configurator config.
merge_yml ( string $path, $current_alias = null ) Load a YAML file of parameters into scope.
parse_args ( $arguments ) : array(array) Splits a list of arguments into positional, associative and config.
to_array ( ) : array Get declared configuration values as an array.

Private Methods

Method Description
absolutize ( string &$path, string $base ) Make a path absolute.
arrayify ( mixed &$val ) Conform a variable to an array.
assoc_arg_to_runtime_config ( $key, $value, &$runtime_config ) Handle turning an $assoc_arg into a runtime arg.
load_yml ( string $yml_file ) : array Load values from a YAML file.
unmix_assoc_args ( array $mixed_args, $global_assoc = [], $local_assoc = [] ) : array Separate runtime parameters from command-specific parameters.

Method Details

__construct() public method

public __construct ( string $path )
$path string Path to config spec file.

extract_assoc() public static method

Splits positional args from associative args.
public static extract_assoc ( $arguments ) : array(array)
return array(array)

get_aliases() public method

Get any aliases defined in config files.
public get_aliases ( ) : array
return array

get_spec() public method

Get configuration specification, i.e. list of accepted keys.
public get_spec ( ) : array
return array

merge_array() public method

Merge an array of values into the configurator config.
public merge_array ( array $config )
$config array

merge_yml() public method

Load a YAML file of parameters into scope.
public merge_yml ( string $path, $current_alias = null )
$path string Path to YAML file.

parse_args() public method

Splits a list of arguments into positional, associative and config.
public parse_args ( $arguments ) : array(array)
return array(array)

to_array() public method

Get declared configuration values as an array.
public to_array ( ) : array
return array