Esempio n. 1
0
 /**
  * Execute Command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $sections = ['voting' => RfcService::IN_VOTING, 'discussion' => RfcService::DISCUSSION, 'draft' => RfcService::DRAFT, 'accepted' => RfcService::ACCEPTED, 'declined' => RfcService::DECLINED, 'withdrawn' => RfcService::WITHDRAWN, 'inactive' => RfcService::INACTIVE];
     $sections = array_intersect_key($sections, array_filter($input->getOptions()));
     if (count($sections) === 0 && !$input->getOption('all')) {
         $sections[] = RfcService::IN_VOTING;
     }
     $table = new Table($output);
     $titleStyle = new TableStyle();
     $titleStyle->setCellRowFormat('<comment>%s</comment>');
     $lists = $this->rfcService->getLists($sections);
     $table->setHeaders(['RFC', 'RFC Code']);
     foreach ($lists as $heading => $list) {
         $table->addRow([$heading], $titleStyle);
         $table->addRow(new TableSeparator());
         foreach ($list as $listing) {
             $table->addRow($listing);
         }
         if ($list !== end($lists)) {
             $table->addRow(new TableSeparator());
         }
     }
     $table->render();
 }