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

TextRenderer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 8 1
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