Exemple #1
0
 /**
  * (non-PHPdoc)
  * @see Symfony\Component\Console\Command.Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Load configuration file
     $configPath = $input->getOption('config');
     if (null === $configPath) {
         $configPath = $this->getDefaultConfigPath();
     }
     try {
         $config = $this->loadConfig($configPath);
     } catch (Exception $exception) {
         $output->writeln($exception->getMessage());
     }
     $pluginManager = new PluginManager($config['plugins']);
     $path = $input->getArgument('path');
     $projectIterator = new ProjectIterator($path, $pluginManager);
     $report = new Report($projectIterator, $pluginManager, $config);
     $report->getProject()->setPath($path);
     $rendererManager = new RendererManager($config['renderers']);
     $rendererManager->render($report);
 }
Exemple #2
0
 protected function renderTemplates(\Twig_Environment $twig, Report $report, $theme, $destinationDirectory)
 {
     // Main pages
     $templates = array("theme/{$theme}/configuration.twig" => 'configuration.html', "theme/{$theme}/items.twig" => 'items.html', "theme/{$theme}/plugins.twig" => 'plugins.html', "theme/{$theme}/project.twig" => 'index.html');
     foreach ($templates as $templateName => $destinationName) {
         $this->renderTemplate($twig, array('report' => $report), $templateName, $destinationDirectory . '/' . $destinationName);
     }
     // Items pages
     foreach ($report->getItems() as $item) {
         $destinationName = 'item-' . md5($item->getRealPath()) . '.html';
         $this->renderTemplate($twig, array('item' => $item, 'report' => $report), "theme/{$theme}/item.twig", $destinationDirectory . '/' . $destinationName);
     }
     // Plugins pages
     foreach ($report->getPlugins()->getPluginManager()->getPlugins() as $plugin) {
         $destinationName = 'plugin-' . $plugin->getCode() . '.html';
         $this->renderTemplate($twig, array('plugin' => $plugin, 'report' => $report), "theme/{$theme}/plugin.twig", $destinationDirectory . '/' . $destinationName);
     }
 }
Exemple #3
0
 public function render(Report $report)
 {
     file_put_contents($this->getDestination(), json_encode($report->toArray()));
 }