コード例 #1
0
ファイル: TodoCommand.php プロジェクト: activecollab/shade
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     ini_set('date.timezone', 'UTC');
     $project = new Project(getcwd());
     if ($project->isValid()) {
         Shade::initSmarty($project, Shade::getBuildTheme($project->getDefaultBuildTheme()));
         $this->renderEverything($project, $input->getOption('locale'));
         $todo_notes = Shade::getTodo();
         if (count($todo_notes)) {
             $table = new Table($output);
             $table->setHeaders(['Message', 'File']);
             $path_len = strlen(rtrim($project->getPath(), '/'));
             foreach ($todo_notes as $todo_note) {
                 $table->addRow([$todo_note['message'], substr($todo_note['file'], $path_len + 1)]);
             }
             $table->render();
             $output->writeln('');
             if (count($todo_notes) === 1) {
                 $output->writeln('1 todo note found');
             } else {
                 $output->writeln(count($todo_notes) . ' todo notes found');
             }
         } else {
             $output->writeln('0 todo notes found');
         }
     } else {
         $output->writeln('<error>This is not a valid Shade project</error>');
     }
 }