public function handle(Args $args, IO $io, Command $command) { $tabular = Tabular::getInstance(); $dom = new \DOMDocument('1.0'); $dom->load($args->getArgument('xml')); $tableDom = $tabular->tabulate($dom, $args->getArgument('definition')); if ($args->getOption('debug')) { $io->writeLine($tableDom->saveXml()); } $rows = $tableDom->toArray(); $table = new Table(TableStyle::solidBorder()); $table->setHeaderRow(array_keys(reset($rows) ?: array())); foreach ($rows as $row) { $table->addRow($row); } $table->render($io); }
public function __construct() { $this->tabular = Tabular::getInstance(); $this->document = new \DOMDocument(); $this->document->load(__DIR__ . '/fixtures/report.xml'); }