Get argument specifications
@return OptionCollection
498128
public static function getArgumentSpecifications()
    {
        $specs = new OptionCollection;
        $specs->add('d|dir:', 'Tests directory path')
            ->isa('String');

        $specs->add('s|subdir+', 'Optional, subdirectory pattern, can be used multiple times as OR expression')
            ->isa('String')
            ->defaultValue(null);

        $specs->add('b|bootstrap?', 'Bootstrap file path')
            ->isa('File')
            ->defaultValue(null);

        $specs->add('v|verbose', 'Verbose output')
            ->defaultValue(false);

        $specs->add('show-globals', 'Show values of global variables')->defaultValue(false);
        $specs->add('debug', 'Show debug messages')->defaultValue(false);
        $specs->add('h|help', 'Show help')->defaultValue(false);
        $specs->add('no-colors', 'No colors')->defaultValue(false);
        $specs->add('i|immediate', 'Show error output immediately as it appears')->defaultValue(false);

        $specs->add('server-host?', 'Server host')->defaultValue(null);
        $specs->add('server-root',  'Server root path, default is ./public')->defaultValue('./public');

        return $specs;
    }
841251
public function getArguments()
    {
        $args = [];

        foreach ($this->arguments as $name => $callable) {
            $args[$name] = $this->getArgument($name);
        }

        return $args;
    }
1218150
public function getArgumentDefinitions(): array
    {
        if (!$this->hasArguments()) {
            return [];
        }
        $commandArgumentDefinitions = [];
        $commandMethodReflection = $this->getCommandMethodReflection();
        $annotations = $commandMethodReflection->getTagsValues();
        $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName . 'Command');
        $i = 0;
        foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) {
            $explodedAnnotation = explode(' ', $annotations['param'][$i]);
            array_shift($explodedAnnotation);
            array_shift($explodedAnnotation);
            $description = implode(' ', $explodedAnnotation);
            $required = $commandParameterDefinition['optional'] !== true;
            $commandArgumentDefinitions[] = new CommandArgumentDefinition($commandParameterName, $required, $description);
            $i ++;
        }
        return $commandArgumentDefinitions;
    }
1117108
protected function getOptionsJS()
    {
        $opts = $this->options;
        foreach ( $opts['seriesStorage'] as $label => $options ) {
            $options['label'] = $label;
            $opts['series'][] = $options;
        }
        
        if ( $this->chart->titleHidden() ) {
        	unset( $opts['title'] );
        }
        
        unset($opts['seriesStorage']);
        return $this->makeJSArray( $opts );
    }
17957
public function toOptionArray()
    {
        if (null === $this->options) {
            $collection = $this->collectionFactory->create();
            $collection->addFieldToFilter('is_active', 1);
            $collection->setOrder('identifier', \Magento\Framework\Data\Collection::SORT_ORDER_ASC);

            $options = [
                [
                    'value' => '',
                    'label' => __('-- No Page --')
                ]
            ];

            foreach ($collection as $item) {
                /** @var \Magento\Cms\Model\Page $item */
                $options[] = [
                    'value' => $item->getIdentifier(),
                    'label' => $item->getTitle()
                ];
            }

            $this->options = $options;
        }

        return $this->options;
    }
982565
private function getOptionsResolverFunctionDeclaration()
    {

        // get required properties
        $required = [];
        $optional = [];
        $allowedValues = [];

        // optional
        foreach( $this->entity->dataTypes as $name => $dataType ) {

            // is required
            if( !$dataType->getDefault() and !$dataType->isNullable() ) {
                $required[] = $name;
            } else {
                $optional[] = $name;
            }

            // set allowed values (currently only works for enums)
            if( $dataType->isEnum($enumName) ) {
                // At the moment this is bugged in Symfony.Don't think it is of vital importance. Ignoring for now.
                # $allowedValues[$name] = $enumName;
            }

        }

        // allowed values declaration
        $allowedValuesPhp = '';
        if( $allowedValues ) {
            $allowedValuesPhp = "\n\$resolver->setAllowedValues(\n    array(\n";
            // at the moment this enum supported only
            foreach( $allowedValues as $column => $enumName ) {
                $allowedValuesPhp .= sprintf(
                    '        %s => Enum::getValues(%s),%s',
                    Php::varExport( $column ),
                    Php::varExport( $enumName ),
                    "\n"
                );
            }
            $allowedValuesPhp .= "    )\n);";
            $allowedValuesPhp = new Format( $allowedValuesPhp );
        }

        // require block
        $requiredPhp = new Format();
        if( $required ) {
            $requiredPhp = "\n\$resolver->setRequired(\n" . (new Format(Php::varExport( $required )))->indent(4) . "\n);";
            $requiredPhp = new Format($requiredPhp);
            $requiredPhp->indent(24);
        }

        // optional
        $optionalPhp = new Format();
        if( $optional ) {
            $optionalPhp = "\n\$resolver->setOptional(\n" . (new Format(Php::varExport( $optional )))->indent(4) . "\n);";
            $optionalPhp = new Format($optionalPhp);
            $optionalPhp->indent(24);
        }

        $this->class->addUses('Symfony\Component\OptionsResolver\OptionsResolver');
        $this->class->classComponents[] = new FunctionDeclaration(
            'resolverGet',
            new Sformatf( <<<'PHP'
                /**
                 * Resolver getter. Singleton
                 * @return Symfony\Component\Options\Resolver
                 */
                public function resolverGet()
                {
                    // do we already have a resolver instance
                    if( !$this->resolver ) {

                        $resolver = new OptionsResolver();%s%s%s
                        $this->resolver = $resolver;

                    }
                    return $this->resolver;
                }
PHP
                , $requiredPhp,
                $optionalPhp,
                $allowedValuesPhp
            )
        );

        $this->class->classComponents[] = new VariableDeclaration(
            'resolver',
            new SFormatf( <<<'PHP'
                /**
                 * Options Resolver
                 * @var array
                 */
                private $resolver;
PHP
            )
        );

    }
659830
public function getGridParentOptions(): array
    {
        $columns[] = 'tl_content.type = ?';
        $columns[] = 'tl_content.pid = ?';
        $columns[] = 'tl_content.ptable = ?';

        $values[] = 'bs_gridStart';
        $values[] = CURRENT_ID;
        $values[] = $GLOBALS['TL_DCA']['tl_content']['config']['ptable'];

        $collection = $this->repository->findBy($columns, $values, ['tl_content.sorting']);
        $options    = [];

        if ($collection) {
            foreach ($collection as $model) {
                $options[$model->id] = sprintf(
                    '%s [%s]',
                    $model->bs_grid_name,
                    $model->getRelated('bs_grid')->title
                );
            }
        }

        return $options;
    }
1175954
protected function getPHPActionOptions() : array
    {
        $options = [];
        $addOption = $this->io->ask('  <info>Add a validator option?</info> <comment>[y,n]</comment> ', 'n');
        while (IOUtil::answerToBool($addOption)) {
            $options = array_merge($options, $this->getPHPActionOption());
            // add another action?
            $addOption = $this->io->ask('  <info>Add another validator option?</info> <comment>[y,n]</comment> ', 'n');
        }
        return $options;
    }
1050793
protected function getOptions()
    {
        if (!is_array($this->arguments['options']) && !($this->arguments['options'] instanceof \Traversable)) {
            return [];
        }
        $options = [];
        foreach ($this->arguments['options'] as $key => $value) {
            if (is_object($value)) {
                if ($this->hasArgument('optionValueField')) {
                    $key = ObjectAccess::getPropertyPath($value, $this->arguments['optionValueField']);
                    if (is_object($key)) {
                        if (method_exists($key, '__toString')) {
                            $key = (string)$key;
                        } else {
                            throw new ViewHelper\Exception('Identifying value for object of class "' . get_class($value) . '" was an object.', 1247827428);
                        }
                    }
                } elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
                    $key = $this->persistenceManager->getIdentifierByObject($value);
                } elseif (method_exists($value, '__toString')) {
                    $key = (string)$value;
                } else {
                    throw new ViewHelper\Exception('No identifying value for object of class "' . get_class($value) . '" found.', 1247826696);
                }

                if ($this->hasArgument('optionLabelField')) {
                    $value = ObjectAccess::getPropertyPath($value, $this->arguments['optionLabelField']);
                    if (is_object($value)) {
                        if (method_exists($value, '__toString')) {
                            $value = (string)$value;
                        } else {
                            throw new ViewHelper\Exception('Label value for object of class "' . get_class($value) . '" was an object without a __toString() method.', 1247827553);
                        }
                    }
                } elseif (method_exists($value, '__toString')) {
                    $value = (string)$value;
                } elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
                    $value = $this->persistenceManager->getIdentifierByObject($value);
                }
            }

            if ($this->hasArgument('translate')) {
                $value = $this->getTranslatedLabel($key, $value);
            }

            $options[$key] = $value;
        }
        if ($this->arguments['sortByOptionLabel']) {
            asort($options);
        }
        return $options;
    }
1334449
public function getArguments(): array
    {
        $result = [];
        foreach ($this->arguments as $arg) {
            $parts = $arg->getParts();
            if ($parts !== null) {
                foreach ($parts as $part) {
                    $result[] = $part;
                }
            }
        }

        return $result;
    }
807286
public function getOptions()
    {
        if ($record = $this->getOwnerRecord()) {
            /** @var DataObject|CommentsExtension $record */
            return $record->getCommentsOptions();
        }

        // Otherwise a singleton of that record
        if ($class = $this->getParentClass()) {
            return singleton($class)->getCommentsOptions();
        }

        // Otherwise just use the default options
        return singleton(CommentsExtension::class)->getCommentsOptions();
    }
201973
public function getGridOptions(): array
    {
        $collection = GridModel::findAll(['order' => 'tl_bs_grid.title']);
        $options    = [];

        if ($collection) {
            foreach ($collection as $model) {
                $parent = sprintf(
                    '%s [ID %s]',
                    $model->getRelated('pid')->name,
                    $model->pid
                );

                $options[$parent][$model->id] = sprintf('%s [ID %s]', $model->title, $model->id);
            }
        }

        return $options;
    }
274593
protected function constructArguments()
    {
        $args = [];
        foreach ($this->options as $option => $value) {
            if (is_bool($value)) {
                $args[] = '--' . $option . '=' . ($value ? 'yes' : 'no');
            } elseif (is_array($value)) {
                foreach ($value as $v) {
                    $args[] = '--' . $option . '=' . escapeshellarg($v);
                }
            } else {
                $args[] = '--' . $option . '=' . escapeshellarg($value);
            }
        }

        return implode(' ', $args);
    }
381928
public function getOptionParser() {
		$parser = parent::getOptionParser();

		$infoParser = $parser->toArray();
		$infoParser['arguments']['url'] = [
			'help' => 'Absolute URL',
			'required' => false
		];

		$parser->description('Cache Shell to cleanup caching of view files.')
				->addSubcommand('status', [
					'help' => 'Status information about the files',
					'parser' => $infoParser,
				])
				->addSubcommand('clear', [
					'help' => 'Clear all or part of the files',
					'parser' => $parser
				]);

		return $parser;
	}
161083
private function extractArguments(): array
    {
        $parameters = [];

        //Use the Reflection API to create Parameter Value object
        foreach ($this->getReflectionInstance()->getParameters() as $param) {
            $name = $param->getName();
            $hasDefault = $param->isDefaultValueAvailable();

            //Default value. To null if the parameter has no default value
            $defaultValue = null;
            if (true === $hasDefault) {
                $defaultValue = $param->getDefaultValue();
            }
            $class = $param->getClass();

            $parameters[$name] = new Parameter($name, $hasDefault, $defaultValue, $class);
        }

        return $parameters;
    }
1303243
protected function getOptions(): array
	{
		$options = [];

		foreach($this->options as $group)
		{
			foreach($group as $name => $option)
			{
				$options[] = ['--' . $name, $option['description']];
			}
		}

		sort($options);

		return $options;
	}
1060883
protected function getModelArguments() : array
    {
        $models = $this->argument('models');

        if (empty($models)) {
            $models = [
                '\Laranix\Auth\Email\Verification\Verification',
                '\Laranix\Auth\Password\Reset\Reset'
            ];
        }

        return $this->validateArgs($models);
    }