public function runWpCliCommand($command, $subcommand, $args = [], $debug = false)
{
$cliCommand = "wp {$command}";
if ($subcommand) {
$cliCommand .= " {$subcommand}";
}
foreach ((array) $args as $name => $value) {
if (is_int($name)) {
// positional argument
$cliCommand .= " " . ProcessUtils::escapeshellarg($value, null);
} elseif ($value !== null) {
$escapedValue = ProcessUtils::escapeshellarg($value, null);
$cliCommand .= " --{$name}={$escapedValue}";
} else {
$cliCommand .= " --{$name}";
}
}
return $this->exec($cliCommand, null, $debug);
}