Liip\RMT\Information\InformationCollector::getCommandOptions PHP Méthode

getCommandOptions() public méthode

Return a set of command request, converted from the Base Request
public getCommandOptions ( ) : InputOption[]
Résultat InputOption[]
    public function getCommandOptions()
    {
        $consoleOptions = array();
        foreach ($this->requests as $name => $request) {
            if ($request->isAvailableAsCommandOption()) {
                $consoleOptions[$name] = $request->convertToCommandOption();
            }
        }
        return $consoleOptions;
    }

Usage Example

 protected function configure()
 {
     $this->setName('init');
     $this->setDescription('Setup a new project configuration in the current directory');
     $this->setHelp('The <comment>init</comment> interactive task can be used to setup a new project');
     // Create an information collector and configure the different information request
     $this->informationCollector = new \Liip\RMT\Information\InformationCollector();
     $this->informationCollector->registerRequests(array(new InformationRequest('vcs', array('description' => 'The VCS system to use', 'type' => 'choice', 'choices' => array('git', 'hg', 'none'), 'choices_shortcuts' => array('g' => 'git', 'h' => 'hg', 'n' => 'none'), 'default' => 'none')), new InformationRequest('persister', array('description' => 'The strategy to use to persist the current version value', 'type' => 'choice', 'choices' => array('vcs-tag', 'changelog', 'composer'), 'choices_shortcuts' => array('t' => 'vcs-tag', 'c' => 'composer', 'l' => 'changelog'), 'command_argument' => true, 'interactive' => true))));
     foreach ($this->informationCollector->getCommandOptions() as $option) {
         $this->getDefinition()->addOption($option);
     }
 }
All Usage Examples Of Liip\RMT\Information\InformationCollector::getCommandOptions