Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($slot_id = $input->getArgument('slot_id')) {
         $slot = $this->repository->slot($slot_id);
     } else {
         $slot = $this->repository->latest();
     }
     if ($slot) {
         $details = $this->connector->ticketDetails($slot->tid);
         list($slot_id, $continued) = $this->repository->start($slot->tid, $slot->comment, $slot->id);
         $output->writeln(sprintf('<bg=blue;fg=white;options=bold>[%s]</> <comment>%s</comment> entry for <info>%d</info>: %s [slot:<comment>%d</comment>]', (new \DateTime())->format('h:i'), $continued ? 'Continued' : 'Started new', $slot->tid, $details->getTitle(), $slot_id));
         return;
     }
     $output->writeln('<error>Could not find the slot to continue</error>');
 }