protected function addPrompts(array $options = [])
    {
        $resolver = $this->getConfigResolver();

        $optionNames = [];
        foreach ($options as $key => $value) {
            if (is_string($value)) {
                $optionNames[] = $value;
                $this->promptConfig[$key] = $resolver->resolve([]);

                continue;
            }

            if (is_array($value)) {
                $optionNames[] = $key;
                $this->promptConfig[$key] = $resolver->resolve($value);

                continue;
            }

            throw new \InvalidArgumentException("Invalid value passed into `addPrompts`.");
        }

        $this->consolePrompts = array_unique(array_merge($this->consolePrompts, $optionNames));
        foreach ($optionNames as $option) {
            if ($this->getDefinition()->hasOption($option)) {
                continue;
            }

            $this->addOption(
                $option,
                null,
                InputOption::VALUE_OPTIONAL,
                $this->promptConfig[$option]['description']
            );
        }

        return $this;
    }
protected function addPrompts(array $options = [])
    {
        $resolver = $this->getConfigResolver();

        $optionNames = [];
        foreach ($options as $key => $value) {
            if (is_string($value)) {
                $optionNames[] = $value;
                $this->promptConfig[$key] = $resolver->resolve([]);

                continue;
            }

            if (is_array($value)) {
                $optionNames[] = $key;
                $this->promptConfig[$key] = $resolver->resolve($value);

                continue;
            }

            throw new \InvalidArgumentException("Invalid value passed into `addPrompts`.");
        }

        $this->consolePrompts = array_unique(array_merge($this->consolePrompts, $optionNames));
        foreach ($optionNames as $option) {
            if ($this->getDefinition()->hasOption($option)) {
                continue;
            }

            $this->addOption(
                $option,
                null,
                InputOption::VALUE_OPTIONAL,
                $this->promptConfig[$option]['description']
            );
        }

        return $this;
    }
protected function addPrompts ( array $ options = [ ] ) { $ resolver = $ this -> getConfigResolver ( ) ; $ optionNames = [ ] ; foreach ( $ options as $ key => $ value ) { if ( is_string ( $ value ) ) { $ optionNames [ ] = $ value ; $ this -> promptConfig [ $ key ] = $ resolver -> resolve ( [ ] ) ; continue ; } if ( is_array ( $ value ) ) { $ optionNames [ ] = $ key ; $ this -> promptConfig [ $ key ] = $ resolver -> resolve ( $ value ) ; continue ; } throw new \ InvalidArgumentException ( "Invalid value passed into `addPrompts`." ) ; } $ this -> consolePrompts = array_unique ( array_merge ( $ this -> consolePrompts , $ optionNames ) ) ; foreach ( $ optionNames as $ option ) { if ( $ this -> getDefinition ( ) -> hasOption ( $ option ) ) { continue ; } $ this -> addOption ( $ option , null , InputOption :: VALUE_OPTIONAL , $ this -> promptConfig [ $ option ] [ 'description' ] ) ; } return $ this ; }
Add prompts through a key value array of option names => their configuration.
The configuration is optional.

e.g.

[
'myOption' => ['type' => 'int'],
'myDefaultOption',
'myOtherOption' => ['description' => 'Hello!']
]

@param array $options

@return static
Add prompts through a key value array of option names = > their configuration . The configuration is optional .