/**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectMagento($output, true);
     if ($this->initMagento()) {
         $table = new \Zend_Text_Table(array('columnWidths' => array(8, 30, 60, 60)));
         $tableData = array();
         if ($this->initMagento()) {
             $time = microtime(true);
             $rewrites = $this->loadRewrites();
             $conflictCounter = 0;
             foreach ($rewrites as $type => $data) {
                 if (count($data) > 0 && is_array($data)) {
                     foreach ($data as $class => $rewriteClass) {
                         if (count($rewriteClass) > 1) {
                             if ($this->_isInheritanceConflict($rewriteClass)) {
                                 $tableData[] = array('Type' => $type, 'Class' => $class, 'Rewrites' => implode(', ', $rewriteClass), 'Loaded Class' => $this->_getLoadedClass($type, $class));
                                 $conflictCounter++;
                             }
                         }
                     }
                 }
             }
             if ($input->getOption('log-junit')) {
                 $this->logJUnit($tableData, $input->getOption('log-junit'), microtime($time) - $time);
             } else {
                 if ($conflictCounter > 0) {
                     array_map(array($table, 'appendRow'), $tableData);
                     $output->write($table->render());
                     $message = sprintf('%d %s found!', $conflictCounter, $conflictCounter == 1 ? 'conflict was' : 'conflicts were');
                     $output->writeln('<error>' . $message . '</error>');
                 } else {
                     $output->writeln('<info>No rewrite conflicts were found.</info>');
                 }
             }
         }
     }
 }
Exemple #2
0
 public function testTableComplex()
 {
     $table = new Zend_Text_Table(array('columnWidths' => array(10, 10, 10)));
     $row = new Zend_Text_Table_Row();
     $row->appendColumn(new Zend_Text_Table_Column('foobar'));
     $row->appendColumn(new Zend_Text_Table_Column('foobar', null, 2));
     $table->appendRow($row);
     $row = new Zend_Text_Table_Row();
     $row->appendColumn(new Zend_Text_Table_Column('foobar'));
     $row->appendColumn(new Zend_Text_Table_Column('foobar', null, 2));
     $table->appendRow($row);
     $row = new Zend_Text_Table_Row();
     $row->appendColumn(new Zend_Text_Table_Column('foobar', null, 3));
     $table->appendRow($row);
     $row = new Zend_Text_Table_Row();
     $row->appendColumn(new Zend_Text_Table_Column('foobar'));
     $row->appendColumn(new Zend_Text_Table_Column('foobar'));
     $row->appendColumn(new Zend_Text_Table_Column('foobar'));
     $table->appendRow($row);
     $this->assertEquals($table->render(), "┌──────────┬─────────────────────┐\n" . "│foobar    │foobar               │\n" . "├──────────┼─────────────────────┤\n" . "│foobar    │foobar               │\n" . "├──────────┴─────────────────────┤\n" . "│foobar                          │\n" . "├──────────┬──────────┬──────────┤\n" . "│foobar    │foobar    │foobar    │\n" . "└──────────┴──────────┴──────────┘\n");
 }