Merges user options with default options
Also casts boolean options to string ('true', 'false')
@param array $defaulOptions
@param array $options
@return array merged options
355407
protected function mergeOptions(array $defaulOptions, array $options = null)
    {
        if (is_null($options)) {
            $options = $defaulOptions;
        }

        foreach ($defaulOptions as $key => $value) {
            if (!isset($options[$key])) {
                $options[$key] = $value;
            }
            if (is_bool($options[$key])) {
                $options[$key] = ($options[$key]) ? 'true' : 'false';
            }
        }

        return $options;
    }
1310559
private function resolveOptions(array $options)
    {
        if (!$this->optionsResolver) {
            $this->optionsResolver = new OptionsResolver();

            $this->optionsResolver->setDefaults([
                'validation_groups' => null,
                'constraints' => null,
                'constraints_extra' => null
            ]);
        }

        return $this->optionsResolver->resolve($options);
    }
550632
public function addOptions(array $options)
    {
        foreach ($options as $name => $defaultValue) {
            $this->addOption($name, $defaultValue);
        }

        return $this;
    }
1302604
public function setOptions(array $options)
    {
        if(isset($options['exchange'])){
            if(!is_string($options['exchange'])){
                throw new \UnexpectedValueException('exchange value is not a string, a string is required');
            }
            $this->exchange = $options['exchange'];
            unset($options['exchange']);
        }
        if(isset($options['queue'])){
            if(isset($options['queue']['arguments'])){
                $this->queueOptions = $options['queue'];
            }
            unset($options['queue']);
        }
        $merged = array('uri' => isset($options['connection']) ? $options['connection'] : $this->options['uri']);
        $merge['options'] = array_merge($this->options['options'], (array) @$options['options']);
        $this->options = $merged;
        return $this;
    }
508664
public function setOptions(array $options) {
    foreach ($options as $key => $value) {
      if (is_int($key)) {
        $option  = '--' . $value;
      }
      elseif (strlen($key) == 1) {
        $option = '-' . $key;
        if (!empty($value)) {
          $option .= ' ' . escapeshellarg($value);
        }
      }
      else {
        // Do not render --uri=default.
        if ($key == 'uri' && $value == 'default') {
          continue;
        }
        $option = '--' . $key;
        if (!empty($value)) {
          $option .= '=' . escapeshellarg($value);
        }
      }
      if (!in_array($option, $this->options)) {
        $this->options[] = $option;
      }
    }
    return $this;
  }
1168603
public function addOptions(array $options)
    {
        $existingOptions = $this->getOptions();
        $newOptions = empty($existingOptions) ? $options : array_merge((array)$existingOptions, $options);
        $this->setOptions($newOptions);
        return $this;
    }
378442
protected function mergeOptions(&$config, $options)
    {
        foreach ($config as $paramName => $paramValue) {
            if (isset($options[$paramName])) {
                if (is_array($paramValue)) {
                    $config[$paramName] =  array_merge($config[$paramName], $options[$paramName]);
                } else {
                    $config[$paramName] = $options[$paramName];
                }
            }
        }

        return $config;
    }
886116
protected function consolidateOptions(array $implementationOptions, array $userOptions): array
    {
        // Filter out the forbidden option
        $userOptions = array_diff_key($userOptions, array_flip($this->forbiddenOptions));

        // Merge the user options with the implementation ones
        return array_merge($implementationOptions, $userOptions);
    }
1101851
public function options($options = [])
    {
        if (empty($options)) {
            return $this->options;
        }

        $this->options = array_merge($this->options, $options);
    }
37471
public function mergeWith(Translations $translations, $options = Merge::DEFAULTS)
    {
        Merge::mergeHeaders($translations, $this, $options);
        Merge::mergeTranslations($translations, $this, $options);

        return $this;
    }
677220
public function setOptionsArray($options) {
    foreach($options as $key => $value) {
      if (!$this->setOption($key, $value)) {
        return false;
      }
    }
    return true;
  }
418887
public function defineOptions(array $defaults, array $userOptions = null, $recursive = false)
    {

        $this->options = $defaults;

        if ($userOptions)
            $this->mergeOptions($userOptions, $recursive);
    }
1258219
public function addOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $this->setOption($name, $value);
        }

        return $this;
    }
504324
protected function mergeOptions(array $options)
    {
        $mergedOptions = $this->options;

        foreach ($options as $name => $value) {
            if (!array_key_exists($name, $mergedOptions)) {
                throw new \InvalidArgumentException(sprintf('The option \'%s\' does not exist.', $name));
            }

            $mergedOptions[$name] = $value;
        }

        return $mergedOptions;
    }
1205418
protected function _mergeOptions($options) {
		if (!is_array($options)) {
			$type = $options;
			if (!$type) {
				$type = 'info';
			}
			$options = [
				'type' => $type,
			];
		}

		$options = $this->_transformCrudOptions($options);

		if (isset($options['element']) && !isset($options['type'])) {
			$options['type'] = $options['element'];
		}

		$options += ['type' => 'info'];
		$options += ['element' => $options['type']];

		$options += (array)$this->getConfig();

		return $options;
	}
507753
protected static function checkOptions(array $options)
    {
        if (isset($options['value'])) {
            $value = $options['value'];
            unset($options['value']);
            $options['value'] = $value;
        }

        return $options;
    }
1223874
public function setOptions(array $options)
	{
		$base_options = array(
			'NODE_PATH' => 'node',
			'NPM_PATH' => __DIR__ . '/../../node_modules/',
			'CACHE_DIRECTORY' => 'cache/',
		);

		foreach ($base_options as $key => $default)
		{
			if (isset($options[$key]))
			{
				$this->options[$key] = $options[$key];
				unset($options[$key]);
			}
			else
				$this->options[$key] = $default;
		}

		return $options;
	}