Prepare options.

@param array $options

@return array
515355
protected function prepare_options($options)
    {
        $original = [];
        $toReplace = [];

        foreach ($options as $key => &$value) {
            if (is_array($value)) {
                $subArray = $this->prepare_options($value);
                $value = $subArray['options'];
                $original = array_merge($original, $subArray['original']);
                $toReplace = array_merge($toReplace, $subArray['toReplace']);
            } elseif (preg_match('/function.*?/', $value)) {
                $original[] = $value;
                $value = "%{$key}%";
                $toReplace[] = "\"{$value}\"";
            }
        }

        return compact('original', 'toReplace', 'options');
    }
867973
public function setOptions(Array $options)
    {
        foreach ($options as $optionName => $optionValue) {
            $this->setTableConfig($optionName, $optionValue);
        }
        return $this;
    }
879874
public function setOptions(array $options)
    {
        foreach ($options as $option => $value) {
            $methodName = 'set'.ucfirst($option);
            if (method_exists($this, $methodName)) {
                $this->$methodName($value);
            }
        }
    }
102799
private static function adjustOptions(array $options) {
        $result = [];

        foreach($options as $key => $value) {
            $result[str_replace("-", "_", $key)] = $value;
        }

        return $result;
    }
1101851
public function options($options = [])
    {
        if (empty($options)) {
            return $this->options;
        }

        $this->options = array_merge($this->options, $options);
    }
209517
public function addOptions(array $options) : Getopt
    {
        if (!empty($this->options)){
            $this->options = array_merge($this->options, $options);
        }
        else{
            $this->options = $options;
        }
        return $this;
    }
931711
protected function prepareConstructOption($options) {
        if ($options instanceof DatabaseConfiguration) {
            $options = $options->toArray();
        }
        $opts    = array_merge([
            'encoding'       => 'UTF8',
            'dbname'         => '',
            'host'           => 'localhost',
            'port'           => 3306,
            'user'           => 'root',
            'password'       => 'root',
            'driver_options' => [
                \PDO::MYSQL_ATTR_COMPRESS => true
            ]
        ], $options);
        $charset = isset ($opts ['encoding']) && !empty ($opts ['encoding']) ? $opts ['encoding'] : 'UTF8';
        if ($charset == null) {
            $dsn = "mysql:dbname={$opts['dbname']};host={$opts['host']};port={$opts['port']}";
        } else {
            $dsn = "mysql:dbname={$opts['dbname']};host={$opts['host']};port={$opts['port']};charset={$charset}";
        }
        $this->charset = $charset;

        return [$dsn, $opts ['user'], $opts ['password'], $opts ['driver_options']];
    }
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;
  }
392839
protected function parseOptions(array $options)
    {
        $options = array_merge($this->defaultOptions, $options);

        foreach ($options as $option => $value) {
            if (! in_array($option, $this->allowedOptions, true)) {
                throw new \InvalidArgumentException("Option [$option] is not allowed.");
            }
        }

        return $options;
    }
643052
protected function getConvertOptions(array $options)
    {
        if ($this->arrHas($options, 'convertOptions')) {
            return $this->arrGet($options, 'convertOptions', []);
        }

        return $this->arrGet($options, 'convert_options', []);
    }
1125640
protected function getOptions(array $options)
    {
        $labels = [];
        if ($this->hasLanguages()) {
            // As this point we are construction the options for multiple languages
            foreach ($this->languages as $language) {
                foreach ($options as $key => $option) {
                    $labels[$language][$key] = Helpers::convertNameToLabel($option);
                }
            }
        } else {

            // At this point we are just formatting the labels
            foreach ($options as $key => $option) {
                $labels[$key] = Helpers::convertNameToLabel($option);
            }
        }

        return $labels;
    }
65407
protected function prepareOptions(array $options = [])
    {
        $helper = $this->formHelper;

        if (array_get($this->options, 'template') !== null) {
            $this->template = array_pull($this->options, 'template');
        }

        $options = $helper->mergeOptions($this->options, $options);

        if ($this->parent->haveErrorsEnabled()) {
            $this->addErrorClass($options);
        }

        if ($this->getOption('attr.multiple')) {
            $this->name = $this->name.'[]';
        }

        if ($this->getOption('required') === true) {
            $options['label_attr']['class'] .= ' ' . $this->formHelper
                ->getConfig('defaults.required_class', 'required');
            $options['attr']['required'] = 'required';
        }

        $options['wrapperAttrs'] = $helper->prepareAttributes($options['wrapper']);
        $options['errorAttrs'] = $helper->prepareAttributes($options['errors']);

        if ($options['is_child']) {
            $options['labelAttrs'] = $helper->prepareAttributes($options['label_attr']);
        }

        if ($options['help_block']['text']) {
            $options['help_block']['helpBlockAttrs'] = $helper->prepareAttributes(
                $options['help_block']['attr']
            );
        }

        return $options;
    }
612143
protected function getOptions(array  $options): array
    {
        $options['format'] = array_get($options, 'format', $this->format);
        $options['locale'] = array_get($options, 'locale', config('app.locale'));

        return $options;
    }
694779
public function options(array $options): self
    {
        foreach ($options as $key => $value) {
            $this->set('options.'.$key, $value);
        }

        return $this;
    }
482336
public function setOptions(array $options)
    {
        foreach ($options as $option => $value) {
            if (property_exists($this, $option)) {
                $this->{$option} = $value;
            }
        }

        return $this;
    }
569629
protected function prepareOptions(Options $options)
    {
        if ($options->getConvertImagesToBase64() === true) {

            $preparedHeaderContent = $this->convertImagesToBase64($options->getHeaderContent());
            $preparedFooterContent = $this->convertImagesToBase64($options->getFooterContent());

            $options->setHeaderContent($preparedHeaderContent);
            $options->setFooterContent($preparedFooterContent);
        }

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

        return $options;
    }
518901
public function formatTableOptions(array $options) {
        $output = [];

        foreach ($this->formatAttributes($options) as $key => $value) {
            if ($this->hasClause($key)) {
                $option = sprintf($this->getClause($key), $value);

            } else {
                $option = $this->getKeyword($key);

                if ($value !== true) {
                    $option .= ' ' . $value;
                }
            }

            $output[] = $option;
        }

        return implode(' ', $output);
    }