Process options and produce an arguments string for PHPTAL Lint.
@return array
436559
protected function getFlags()
    {
        $tales = '';
        if (!empty($this->tales)) {
            $tales = ' -i ' . $this->phpci->buildPath . $this->tales;
        }

        $suffixes = '';
        if (count($this->suffixes)) {
            $suffixes = ' -e ' . implode(',', $this->suffixes);
        }

        return array($suffixes, $tales);
    }
1330647
public function getOptions()
    {
        // debug
        $this->options['debug'] = ($this->option('debug')) ? true : false;

        // connection
        $this->options['connection'] = ($this->option('connection')) ? $this->option('connection') : '';

        // folder
        $this->options['folder'] = ($this->option('folder')) ? base_path($this->option('folder')) : app()->path();
        // trim trailing slashes
        $this->options['folder'] = rtrim($this->options['folder'], '/');

        // namespace
        $this->options['namespace'] = ($this->option('namespace')) ? str_replace('app', 'App', $this->option('namespace')) : 'App';
        // remove trailing slash if exists
        $this->options['namespace'] = rtrim($this->options['namespace'], '/');
        // fix slashes
        $this->options['namespace'] = str_replace('/', '\\', $this->options['namespace']);

        // all tables
        $this->options['all'] = ($this->option('all')) ? true : false;

        // single or list of tables
        $this->options['table'] = ($this->option('table')) ? $this->option('table') : '';

        // class name and class file name singular/plural
        $this->options['singular'] = ($this->option('singular')) ? $this->option('singular') : '';
    }
1351638
public function getOptionsDescriptions()
    {
        return array_merge_recursive(parent::getOptionsDescriptions(), [
            self::OPTION_BASE_PATH => ['Base path to look for the json file', []],
            self::OPTION_FILENAME => ['Name of the file to load', []],
            self::OPTION_TYPE => ['Name of the type', []],//e.g. body or headers
        ]);
    }
154139
protected function assembleOptionString()
    {
        $optionString = '';

        foreach ($this->options as $name => $option) {
            if ($option === true) {
                $optionString .= " {$name}";
            } elseif (is_string($option) && $option !== '') {
                $optionString .= " {$name} " . escapeshellarg($option);
            } elseif (is_array($option) && !empty($option)) {
                $optionString .= " {$name} " . implode(' ', $option);
            }
        }

        return $optionString !== '' ? $optionString . '' : ' ';
    }
874238
public function getOptionsForConsole()
    {
        $builder = '';

        foreach ($this->options as $option => $value) {
            $builder .= '--' . $option;

            if ($value) {
                $builder .= '=' . $value;
            }

            $builder .= ' ';
        }

        return $builder;
    }
175750
public function getArgumentValues()
    {
        $this->parseIfNotParsed();
        return array_map(function(Option $argument) {
            return $argument->getValue();
        }, $this->arguments);
    }
636437
public function phpLint()
    {
        $paths = $this->getPaths();
        $this->stopOnFail(true);
        $this->info('Starting syntax check of PHP source files');
        $iterator = Finder::create()
            ->files()
            ->name('*.php')
            ->in($paths['src'])
            ->sortByName();
        /** @var SplFileInfo $file */
        foreach ($iterator as $file) {
            $command = $this->taskExec('php');
            $command
                ->arg('-l')
                ->arg($file->getRealPath())
                ->printOutput(false)
                ->run();
        }
        $this->info('PHP source files passed syntax check');
    }
940607
private function optionsAsText()
    {
        $max = $this->getMaxWidth();
        $messages = [];

        $options = $this->getOptions();
        if ($options) {
            $messages[] = '<comment>Options:</comment>';

            foreach ($options as $option) {
                if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
                    $default = \sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($option->getDefault()));
                } else {
                    $default = '';
                }

                $multiple = $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '';
                $description = \str_replace("\n", "\n" . \str_pad('', $max + 2, ' '), $option->getDescription());

                $optionMax = $max - \strlen($option->getName()) - 2;
                $messages[] = \sprintf(
                    " <info>%s</info> %-${optionMax}s%s%s%s",
                    '--' . $option->getName(),
                    $option->getShortcut() ? \sprintf('(-%s) ', $option->getShortcut()) : '',
                    $description,
                    $default,
                    $multiple
                );
            }

            $messages[] = '';
        }

        return \implode(PHP_EOL, $messages);
    }
1047350
public function getArgs()
    {
        $args = array(
            '--' . $this->getType()
        );

        foreach ($this as $name => $value) {
            if (!in_array($name, array('inbuffer')) && $value !== null && $value !== false && !is_array($value)) {
                $name = $this->decamelize($name);

                if ($value !== true) {
                    // append value if this is not a boolean arg
                    $name .= '=' . $value;
                }

                // all arguments start with a double dash
                $args []= '--' . $name;
            }
        }

        return $args;
    }
1289670
private function parseArgs(): array
    {
        if (null === $this->options && count($this->longopts) === 0 && null === $this->userInput) {
            return $this->fixArgs($_SERVER['argv']);
        }

        if (null !== $this->userInput) {
            $this->collectOptionsFromUserInputClass();
        }

        $parseCommandLineOptions = $this->cliOptionParser;
        $parsedVars = $parseCommandLineOptions($this->options, $this->longopts);
        if (false === $parsedVars) {
            throw new \RuntimeException(
                    'Error parsing "' . join(' ', $_SERVER['argv'])
                    . '" with ' . $this->options
                    . ' and ' . join(' ', $this->longopts)
            );
        }

        return $this->fixArgs($_SERVER['argv'], $parsedVars);
    }
143612
public function getArguments(): array
    {
        // We will need to process the arguments and merge them.
        $arguments = parent::getArguments();

        // If we have outfile setup don't act!
        foreach ($arguments as $argument) {
            if (strstr($argument, '-outfile') !== false) {
                return $arguments;
            }
        }

        if ($this->isOutSourceEqual()) // Check if not already specified
        {
            $this->outFileTemp = tempnam(sys_get_temp_dir(), 'img-prfy-');
            $arguments[] = '-outfile '.escapeshellarg($this->outFileTemp);
        } else {
            $arguments[] = '-outfile '.escapeshellarg($this->getOutFile());
        }

        return $arguments;
    }
1085699
protected function getOptions()
    {
        // Allow path to be overridden.
        $options[] = array(
            'path',
            null,
            InputOption::VALUE_OPTIONAL,
            'Path containing the files to be inspected.',
            'app'
        );

        // Offer to install the ruleset locally if available.
        $this->setPaths();
        if ($this->pathRulesetStock !== null) {
            $options[] = array(
                'install-ruleset',
                null,
                InputOption::VALUE_NONE,
                'Copy our ruleset into your project.'
            );
        }

        return $options;
    }
151535
protected function getRoutineArgs(): string
  {
    $ret = '';

    foreach ($this->routine['parameters'] as $parameter_info)
    {
      $mangledName = $this->nameMangler->getParameterName($parameter_info['parameter_name']);

      if ($ret) $ret .= ',';
      $ret .= DataTypeHelper::escapePhpExpression($parameter_info, '$'.$mangledName, $this->lobAsStringFlag);
    }

    return $ret;
  }
556132
public function getOptionParamNames() : array
   {

      $out = [];

      foreach ( $this->_attributes as $attributeName => $attribute )
      {
         if ( Type::OPTION_PARAM === $attribute->getType() )
         {
            $out[] = $attributeName;
         }
      }

      return $out;

   }
604317
protected function getOptions()
	{
		$options = array();

		/** @var \SimpleXMLElement $option */
		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			$text = $this->translateOptions
				? $this->getText()->alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))
				: trim((string) $option);

			// Set up option elements.
			$tmp = new stdClass;
			$tmp->value = (string) $option['value'];
			$tmp->text = $text;
			$tmp->disable = ((string) $option['disabled'] == 'true');
			$tmp->class = (string) $option['class'];
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
319727
protected function prepareCurlOptions()
    {
        $opts = array();
        $url = $this->url;

        // CURLOPT_RESOLVE
        if ($this->ip) {
            $host = parse_url($url, PHP_URL_HOST);
            $url = substr_replace($url, $this->ip, strpos($url, $host), strlen($host));
            $this->headers['Host'] = $host;
        }

        switch ($this->method) {
            case 'GET' :
                $postData = false;
                break;

            case 'POST' :
                $postData = true;
                $opts[CURLOPT_POST] = 1;
                break;

            case 'DELETE':
            case 'PUT':
            case 'PATCH':
                $postData = true;
                $opts[CURLOPT_CUSTOMREQUEST] = $this->method;
                break;

            default:
                $postData = false;
                $opts[CURLOPT_CUSTOMREQUEST] = $this->method;
        }

        if ($this->data) {
            $data = is_string($this->data) ? $this->data : http_build_query($this->data);
            if ($postData) {
                $opts[CURLOPT_POSTFIELDS] = $data;
            } else {
                if (false === strpos($url, '?')) {
                    $url .= '?' . $data;
                } else {
                    $url .= '&' . $data;
                }
            }
        }

        if ($this->files) {
            $postFields = isset($opts[CURLOPT_POSTFIELDS]) ? $opts[CURLOPT_POSTFIELDS] : '';
            $opts[CURLOPT_POSTFIELDS] = $this->addFileField($postFields, $this->files);
        }

        if ($this->timeout > 0) {
            $opts[CURLOPT_TIMEOUT_MS] = $this->timeout;
        }

        if ($this->referer) {
            // Automatic use current request URL as referer URL
            if (true === $this->referer) {
                $opts[CURLOPT_REFERER] = $this->url;
            } else {
                $opts[CURLOPT_REFERER] = $this->referer;
            }
        }

        if ($this->userAgent) {
            $opts[CURLOPT_USERAGENT] = $this->userAgent;
        }

        if ($this->cookies) {
            $cookies = array();
            foreach ($this->cookies as $key => $value) {
                $cookies[] = $key . '=' . urlencode($value);
            }
            $opts[CURLOPT_COOKIE] = implode('; ', $cookies);
        }

        if ($this->contentType) {
            $this->headers['Content-Type'] = $this->contentType;
        }

        // Custom headers will overwrite other options
        if ($this->headers) {
            $headers = array();
            foreach ($this->headers as $key => $value) {
                $headers[] = $key . ': ' . $value;
            }
            $opts[CURLOPT_HTTPHEADER] = $headers;
        }

        $opts[CURLOPT_HEADER] = $this->header;
        $opts[CURLOPT_URL] = $url;

        $this->curlOptions += $opts + $this->defaultCurlOptions;
        return $this->curlOptions;
    }
699501
private function processOptions()
    {
        $claims = [];

        foreach ($this->options as $name => $value) {
            switch ($name) {
                case 'expires':
                    if ($value instanceof \DateTime) {
                        $claims['exp'] = $value->getTimestamp();
                    }
                    break;
                case 'notBefore':
                    if ($value instanceof \DateTime) {
                        $claims['nbf'] = $value->getTimestamp();
                    }
                    break;
                default:
                    $claims[$name] = $value;
                    break;
            }
        }

        return $claims;
    }