Liip\RMT\Information\InformationCollector::registerRequests PHP Method

registerRequests() public method

public registerRequests ( $list )
    public function registerRequests($list)
    {
        foreach ($list as $request) {
            if (is_string($request)) {
                $this->registerStandardRequest($request);
            } elseif ($request instanceof InformationRequest) {
                $this->registerRequest($request);
            } else {
                throw new \Exception('Invalid request, must a Request class or a string for standard requests');
            }
        }
    }

Usage Example

Example #1
0
 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::registerRequests