Exemple #1
0
 /**
  * Execute command
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @throws \Exception
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->_input = $input;
     $this->_output = $output;
     $this->detectMagento($output, true);
     $this->initMagento();
     $divUtil = new \Mpmd\Util\Div();
     $requestedModules = $this->_input->getArgument('module');
     $allModules = $divUtil->getAllModules();
     $matchCount = array();
     $modules = $divUtil->globArray($allModules, $requestedModules, $matchCount);
     foreach ($matchCount as $pattern => $count) {
         if ($count == 0) {
             throw new \Exception('No match found for pattern: ' . $pattern);
         }
     }
     $output = array();
     $output[] = 'digraph callgraph {';
     $output[] = '';
     $output[] = '    splines=false;';
     $output[] = '    rankdir=LR;';
     $output[] = '    edge[arrowhead=vee, arrowtail=inv, arrowsize=.7, color="#dddddd"];';
     $output[] = '    node [fontname="verdana", shape=plaintext, style="filled", fillcolor="#dddddd"];';
     $output[] = '    fontname="Verdana";';
     $output[] = '';
     foreach ($modules as $module) {
         $dependencies = $divUtil->getDeclaredDepenenciesForModule($module);
         foreach ($dependencies as $dependency) {
             $output[] = "    {$module} -> {$dependency};";
         }
     }
     $output[] = '}';
     echo implode("\n", $output) . "\n";
 }
Exemple #2
0
 /**
  * Execute command
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @throws \Exception
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->_input = $input;
     $this->_output = $output;
     $this->detectMagento($output, true);
     $this->initMagento();
     $divUtil = new \Mpmd\Util\Div();
     $requestedModules = $this->_input->getArgument('module');
     $allModules = $divUtil->getAllModules();
     $matchCount = array();
     $modules = $divUtil->globArray($allModules, $requestedModules, $matchCount);
     foreach ($matchCount as $pattern => $count) {
         if ($count == 0) {
             throw new \Exception('No match found for pattern: ' . $pattern);
         }
     }
     $table = array();
     foreach ($modules as $module) {
         $dependencies = $divUtil->getDeclaredDepenenciesForModule($module);
         if (count($dependencies) == 0) {
             $table[] = array($module, '[No dependency declared]');
         } else {
             foreach ($dependencies as $dependency) {
                 $table[] = array($module, $dependency);
             }
         }
         $table[] = new TableSeparator();
     }
     // Remove TableSeparator at the end of the table
     if (end($table) instanceof TableSeparator) {
         array_pop($table);
     }
     $this->getHelper('table')->setHeaders(array('Module', 'Dependency'))->renderByFormat($output, $table, $input->getOption('format'));
 }