'person.md', 'Intro' => 'intro.md', 'Letter' => 'letter.md' ); /** * {@inheritDoc} * @see \Symfony\Component\Console\Command\Command::configure() */ protected function configure() { $this->setName('dossier:status') ->setDescription('Get the status of the current dossier files'); parent::configure(); } /** * {@inheritDoc} * @see \Symfony\Component\Console\Command\Command::execute() */ protected function execute(InputInterface $input, OutputInterface $output) { $markdown = $this->getService('markdown'); /* @var $markdown \Magdev\Dossier\Service\MarkdownService */ $analyzer = $this->getService('analyzer')->getAnalyzer('model.status'); /* @var $analyzer \Magdev\Dossier\Analyzer\DossierStatusAnalyzer */ $thresholds = $this->config->get('style.dossier_status_thresholds'); $person = new Person($markdown->getDocument(PROJECT_ROOT.'/person.md')); $intro = new Intro($markdown->getDocument(PROJECT_ROOT.'/intro.md')); $status = array(); $status[] = array(get_class($person), 'person.md', $this->io->align('---', 9, DossierStyle::ALIGN_CENTER), $this->io->align($this->io->percent($analyzer->analyze($person), $thresholds), 6, DossierStyle::ALIGN_RIGHT) ); $status[] = array(get_class($intro), 'intro.md', $this->io->align('---', 9, DossierStyle::ALIGN_CENTER), $this->io->align($this->io->percent($analyzer->analyze($intro), $thresholds), 6, DossierStyle::ALIGN_RIGHT) ); $status[] = new TableSeparator(); $files = new \FilesystemIterator(PROJECT_ROOT.'/cv', \FilesystemIterator::SKIP_DOTS); foreach ($files as $file) { /* @var $file \SplFileInfo */ $document = $markdown->getDocument($file->getPathname()); $sortValue = str_replace('-', '', $document->getYAML()['start_date']); $entry = new Entry($document); $status[$sortValue] = array(get_class($entry), 'cv/'.$file->getFilename(), $this->io->align($this->io->bool($entry->useInResume()), 9, DossierStyle::ALIGN_CENTER), $this->io->align($this->io->percent($analyzer->analyze($entry), $thresholds), 6, DossierStyle::ALIGN_RIGHT) ); } ksort($status); $this->io->table(array('Model', 'File', $this->io->align('In Resume', 9), $this->io->align('Status', 6, DossierStyle::ALIGN_RIGHT) ), $status); } }