/**
  * Run the command
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  * @return bool
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $trello = HelperCommand::getTrelloClient($output);
     if (!$trello) {
         return false;
     }
     $member = HelperCommand::getTrelloMember($output);
     if (!$member || empty($member['idBoards'])) {
         return false;
     }
     $boards = [];
     foreach ($member['idBoards'] as $board) {
         if (in_array($board, HelperCommand::$ignoredBoards)) {
             continue;
         }
         $trelloBoard = $trello->getBoard($board);
         if (!$trelloBoard) {
             $error = "Board {$board} failed to load";
             $output->writeln("<error>{$error}</error>");
             continue;
         }
         if ($trelloBoard->closed) {
             continue;
         }
         $boards[$trelloBoard->id] = ['id' => $trelloBoard->id, 'name' => $trelloBoard->name, 'desc' => $trelloBoard->desc, 'url' => $trelloBoard->url, 'prefs' => $trelloBoard->prefs, 'labelNames' => $trelloBoard->labelNames];
     }
     file_put_contents(dirname(__DIR__) . self::FILE_CACHE, Yaml::dump($boards));
     return true;
 }
 /**
  * Run the command
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  * @return bool
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $trello = HelperCommand::getTrelloClient($output);
     if (!$trello) {
         return false;
     }
     $boards = HelperCommand::getCachedBoards($output);
     if (!$boards) {
         return false;
     }
     $listCache = [];
     $config = HelperCommand::getConfig();
     foreach ($boards as $board => $data) {
         $trelloBoard = $trello->getBoard($board);
         if (!$trelloBoard) {
             $error = "Board {$board} failed to load";
             $output->writeln("<error>{$error}</error>");
             continue;
         }
         if (!array_key_exists($board, $config['boards'])) {
             $config['boards'][$board] = HelperCommand::getDefaultBoardConfig();
         }
         $lists = $trelloBoard->getLists();
         $listCache[$board] = [];
         foreach ($lists as $list) {
             $listCache[$board][$list->id] = ['name' => $list->name, 'pos' => $list->pos, 'closed' => $list->closed];
             if (!array_key_exists($list->id, $config['boards'][$board]['lists'])) {
                 $config['boards'][$board]['lists'][] = $list->id;
             }
         }
     }
     HelperCommand::setConfig($config);
     file_put_contents(dirname(__DIR__) . self::FILE_CACHE, Yaml::dump($listCache, 2, 4, false, true));
     return true;
 }
 /**
  * Run the command
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  * @return bool
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     while ($board = $this->selectBoard($input, $output)) {
         $output->writeln('');
         $output->writeln("<info>{$board['name']}</info>");
         $lists = HelperCommand::getCachedLists($output);
         $boardLists = $lists['lists'][$board['id']];
         foreach ($boardLists as $id => $listData) {
             $output->writeln("\t{$listData['name']}");
         }
         $output->writeln('');
     }
     $output->writeln('');
     return true;
 }
 /**
  * Run the command
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  * @return bool
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $trello = HelperCommand::getTrelloClient($output);
     if (!$trello) {
         return false;
     }
     try {
         $member = $trello->get('members/me');
     } catch (\Exception $e) {
         return false;
     }
     if (!$member) {
         return false;
     }
     file_put_contents(dirname(__DIR__) . self::FILE_CACHE, Yaml::dump($member));
     return true;
 }
 /**
  * Run the command
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  * @return bool
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $trello = HelperCommand::getTrelloClient($output);
     $boardKey = $input->getArgument('boardKey');
     $config = HelperCommand::getConfig();
     if (empty($config['boards'][$boardKey])) {
         $output->writeln("<error>Board not in config</error>");
         return false;
     }
     $boardConfig = $config['boards'][$boardKey];
     $cachedBoards = HelperCommand::getCachedBoards($output);
     $cachedLists = HelperCommand::getCachedLists($output);
     $boardLists = $cachedLists[$boardKey];
     $lists = [];
     $cards = [];
     foreach ($boardLists as $listKey => $listData) {
         $lists[$listKey] = $listData['name'];
         $cards[$listKey] = [];
     }
     $trelloCards = $trello->getBoard($boardKey)->getCards();
     foreach ($trelloCards as $card) {
         if (!array_key_exists($card->idList, $lists)) {
             continue;
         }
         $cards[$card->idList][] = ['id' => $card->id, 'url' => $card->shortUrl, 'name' => $card->name];
     }
     $send = '';
     foreach ($cards as $list => $listCards) {
         $send .= "<h3>{$lists[$list]}</h3>";
         foreach ($listCards as $card) {
             $send .= "<a href='{$card['url']}' style='margin-left:30px'>{$card['name']}</a><br/>";
         }
     }
     echo $send;
     $transport = new \Swift_SendmailTransport();
     $mail = new \Swift_Mailer($transport);
     $message = \Swift_Message::newInstance();
     $message->setSubject('Trello:');
     $message->addFrom($boardConfig['email'][0]);
     $message->addTo($boardConfig['email'][0]);
     $message->addPart($send, 'text/html');
     $mail->send($message);
     return true;
 }
 /**
  * Run the command
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  * @return bool
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $boards = HelperCommand::getCachedBoards($output);
     $lists = HelperCommand::getCachedLists($output);
     $boardKey = $input->getArgument('boardKey');
     if ($boardKey) {
         $this->boardKey = $boardKey;
     }
     if (!array_key_exists($boardKey, $boards)) {
         $output->writeln("<error>" . HelperCommand::ERROR_BOARDS . "</error>");
         return false;
     }
     $output->writeln("<info>Lists for '{$boards[$boardKey]['name']}'</info>");
     $boardLists = $lists['lists'][$this->boardKey];
     foreach ($boardLists as $id => $listData) {
         $output->writeln("\t{$listData['name']}");
     }
     $output->writeln('');
     return true;
 }