protected function mergeCommandOptions($userCommand)
{
$commonOptions = ['path' => $this->config['path']];
$lineOptions = [];
$nonOverriddenOptions = [];
foreach ($this->options as $key) {
if ($key !== 'require' && false !== strpos($userCommand, '--' . $key)) {
continue;
}
$nonOverriddenOptions[] = $key;
}
foreach ($nonOverriddenOptions as $key) {
if (isset($this->config[$key])) {
$commonOptions[$key] = $this->config[$key];
}
}
foreach ($commonOptions as $key => $value) {
$lineOptions[] = $value === true ? "--{$key}" : "--{$key}={$value}";
}
return $userCommand . ' ' . implode(' ', $lineOptions);
}