/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { // Allow special date param in the form of _1 for back one day, _2 for two // days etc. $date = $input->getArgument('date'); if (preg_match('/_(\\d+)/', $date, $matches)) { $date = date('Y-m-d', time() - 86400 * $matches[1]); } $data = $this->repository->status($date); $table = new Table($output); $table->setHeaders(['Slot', 'JobId', 'Time', 'Title']); $rows = []; $total = 0; foreach ($data as $record) { $total += $record->duration; $details = $this->connector->ticketDetails($record->tid); if (!empty($record->active)) { $record->tid .= ' *'; } $rows[] = [$record->id, $record->tid, Formatter::formatDuration($record->duration), $details->getTitle()]; } $rows[] = new TableSeparator(); $rows[] = ['', '<comment>Total</comment>', '<info>' . Formatter::formatDuration($total) . '</info>', '']; $table->setRows($rows); $table->render(); }