$value] devient ["--my-arg", "$value"] * - ["myOpt" => true] devient ["--my-opt"] * - ["myOpt" => false] est omis * - les autres valeurs sont prises telles quelles */ static function from_array(?array $array): array { $args = []; if ($array === null) return $args; $index = 0; foreach ($array as $arg => $value) { if ($value === false) continue; if ($arg === $index) { $index++; } else { $arg = str::us2camel($arg); $arg = str::camel2us($arg, false, "-"); $arg = str_replace("_", "-", $arg); $args[] = "--$arg"; if (is_array($value)) $value[] = "--"; elseif ($value === true) $value = null; } if (is_array($value)) { A::merge($args, array_map("strval", $value)); } elseif ($value !== null) { $args[] = "$value"; } } return $args; } }