asciiBorder() public static method

A style that uses ASCII characters for drawing borders.
public static asciiBorder ( ) : TableStyle
return TableStyle The style.
Exemplo n.º 1
0
 /**
  * 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();
 }
Exemplo n.º 2
0
    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());
    }
Exemplo n.º 3
0
 /**
  * @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('');
     }
 }