WP_CLI
Configurator::unmix_assoc_args
Separate runtime parameters from command-specific parameters.
Method of the class: Configurator{}
No Hooks.
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->unmix_assoc_args( $mixed_args, $global_assoc, $local_assoc );
- $mixed_args(array) (required)
- .
- $global_assoc
- .
Default:[] - $local_assoc
- .
Default:[]
Configurator::unmix_assoc_args() Configurator::unmix assoc args code WP-CLI 2.13.0-alpha
private function unmix_assoc_args( $mixed_args, $global_assoc = [], $local_assoc = [] ) {
$assoc_args = [];
$runtime_config = [];
if ( getenv( 'WP_CLI_STRICT_ARGS_MODE' ) ) {
foreach ( $global_assoc as $tmp ) {
list( $key, $value ) = $tmp;
if ( isset( $this->spec[ $key ] ) && false !== $this->spec[ $key ]['runtime'] ) {
$this->assoc_arg_to_runtime_config( $key, $value, $runtime_config );
}
}
foreach ( $local_assoc as $tmp ) {
$assoc_args[ $tmp[0] ] = $tmp[1];
}
} else {
foreach ( $mixed_args as $tmp ) {
list( $key, $value ) = $tmp;
if ( isset( $this->spec[ $key ] ) && false !== $this->spec[ $key ]['runtime'] ) {
$this->assoc_arg_to_runtime_config( $key, $value, $runtime_config );
} else {
$assoc_args[ $key ] = $value;
}
}
}
return [ $assoc_args, $runtime_config ];
}