Completed
Pull Request — master (#169)
by Bill
01:30
created

ConsoleResultsRenderer::getHeader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
3
namespace Churn\Renderers\Results;
4
5
use Churn\Results\ResultCollection;
6
use Symfony\Component\Console\Helper\Table;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class ConsoleResultsRenderer implements ResultsRendererInterface
10
{
11
    /**
12
     * Renders the results.
13
     * @param OutputInterface  $output  Output Interface.
14
     * @param ResultCollection $results Result Collection.
15
     * @return void
16
     */
17
    public function render(OutputInterface $output, ResultCollection $results)
18
    {
19
        $output->write($this->getHeader());
20
21
        $table = new Table($output);
22
        $table->setHeaders(['File', 'Times Changed', 'Complexity', 'Score']);
23
        $table->addRows($results->toArray());
24
        $table->render();
25
26
        $output->write("\n");
27
    }
28
29
    /**
30
     * Get the header.
31
     * @return string
32
     */
33
    private function getHeader(): string
34
    {
35
        return "\n
36
    ___  _   _  __  __  ____  _  _     ____  _   _  ____
37
   / __)( )_( )(  )(  )(  _ \( \( )___(  _ \( )_( )(  _ \
38
  ( (__  ) _ (  )(__)(  )   / )  ((___))___/ ) _ (  )___/
39
   \___)(_) (_)(______)(_)\_)(_)\_)   (__)  (_) (_)(__)      https://github.com/bmitch/churn-php\n\n";
40
    }
41
}
42