A style that uses ASCII characters for drawing borders.
public static asciiBorder ( ) : |
||
return | The style. |
/** * Creates a new table. * * @param TableStyle $style The rendering style. By default, the table is * rendered with the style * {@link TableStyle::asciiBorder()}. */ public function __construct(TableStyle $style = null) { $this->style = $style ?: TableStyle::asciiBorder(); }
public function testRenderFormattedCells() { $table = new Table(TableStyle::asciiBorder()); $table->setHeaderRow(array('ISBN', 'Title', 'Author')); $table->addRows(array(array('<b>99921-58-10-7</b>', 'Divine Comedy', 'Dante Alighieri'), array('<b>9971-5-0210-0</b>', 'A Tale of Two Cities', 'Charles Dickens'), array('<b>960-425-059-0</b>', 'The Lord of the Rings', 'J. R. R. Tolkien'), array('<b>80-902734-1-6</b>', 'And Then There Were None', 'Agatha Christie'))); $table->render($this->io); $expected = <<<'EOF' +---------------+--------------------------+------------------+ | ISBN | Title | Author | +---------------+--------------------------+------------------+ | 99921-58-10-7 | Divine Comedy | Dante Alighieri | | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | | 80-902734-1-6 | And Then There Were None | Agatha Christie | +---------------+--------------------------+------------------+ EOF; $this->assertSame($expected, $this->io->fetchOutput()); }
/** * @param PreDispatchEvent $preDispatchEvent */ public function onPreDispatchEvent(PreDispatchEvent $preDispatchEvent) { if ($this->preDispatchHandler) { call_user_func($this->preDispatchHandler, $preDispatchEvent->event(), $this->io); } else { $this->io->writeLine('<c1>------------------------------------------------------------------------</c1>'); $this->io->writeLine('Dispatching <c1>' . $this->eventToString($preDispatchEvent->event()) . '</c1> with:'); $this->io->writeLine(''); $properties = $this->objectToPropertyArray($preDispatchEvent->event()); $table = new Table(TableStyle::asciiBorder()); $table->setHeaderRow(array_keys($properties)); $table->addRow(array_values($properties)); $table->render($this->io); $this->io->writeLine(''); } }