WP_CLI\Utils
assoc_args_to_str()
Composes associative arguments into a command string.
Хуков нет.
Возвращает
Строку.
Использование
assoc_args_to_str( $assoc_args );
- $assoc_args(обязательный)
- .
Код assoc_args_to_str() assoc args to str WP-CLI 2.13.0-alpha
function assoc_args_to_str( $assoc_args ) {
$str = '';
foreach ( $assoc_args as $key => $value ) {
if ( true === $value ) {
$str .= " --$key";
} elseif ( is_array( $value ) ) {
foreach ( $value as $v ) {
$str .= assoc_args_to_str(
[
$key => $v,
]
);
}
} else {
$str .= " --$key=" . escapeshellarg( $value );
}
}
return $str;
}