Completed
Push — develop ( e2df81...ff4414 )
by Tom
04:40
created

TextRenderer::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4286
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
/*
3
 * @author Tom Klingenberg <[email protected]>
4
 */
5
6
namespace N98\Util\Console\Helper\Table\Renderer;
7
8
use Symfony\Component\Console\Helper\Table;
9
use Symfony\Component\Console\Helper\TableStyle;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
/**
13
 * Class TextRenderer
14
 *
15
 * @package N98\Util\Console\Helper\Table\Renderer
16
 */
17
class TextRenderer implements RendererInterface
18
{
19
20
    /**
21
     * @param OutputInterface $output
22
     * @param array           $rows headers are expected to be the keys of the first row.
23
     */
24
    public function render(OutputInterface $output, array $rows)
25
    {
26
        $table = new Table($output);
27
        $table->setStyle(new TableStyle());
28
        $table->setHeaders(array_keys($rows[0]));
29
        $table->setRows($rows);
30
        $table->render();
31
    }
32
}
33