asciiBorder() 공개 정적인 메소드

A style that uses ASCII characters for drawing borders.
public static asciiBorder ( ) : TableStyle
리턴 TableStyle The style.
예제 #1
0
파일: Table.php 프로젝트: webmozart/console
 /**
  * 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();
 }
예제 #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());
    }
예제 #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('');
     }
 }