Codeception\Module\WPCLI::mergeCommandOptions PHP Method

mergeCommandOptions() protected method

protected mergeCommandOptions ( string $userCommand ) : string
$userCommand string
return string
    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);
    }