Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $job = $input->getArgument('job');
     $build = $input->getArgument('build') ? $input->getArgument('build') : 'lastBuild';
     $api = new Api();
     $res = $api->info($job, $build);
     $rows = [];
     $parameters = [];
     if (isset($res['actions'][0]['parameters']) && is_array($res['actions'][0]['parameters'])) {
         foreach ($res['actions'][0]['parameters'] as $parameter) {
             $parameters[] = implode('=', $parameter);
         }
         $rows[] = ['Parameters', implode("\n", $parameters)];
     }
     foreach ($res as $key => $value) {
         if (is_scalar($value) || is_null($value)) {
             $rows[] = [$key, $value];
         } else {
             $rows[] = [$key, substr(json_encode($value), 0, 100) . '...'];
         }
     }
     $table = new Table($output);
     $table->setRows($rows);
     $table->render();
 }