CsvResultsRenderer::getHeader()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Result\Render;
6
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * @internal
11
 */
12
final class CsvResultsRenderer implements ResultsRendererInterface
13
{
14
    /**
15
     * Renders the results.
16
     *
17
     * @param OutputInterface $output Output Interface.
18
     * @param array<array<float|integer|string>> $results The results.
19
     */
20
    #[\Override]
21
    public function render(OutputInterface $output, array $results): void
22
    {
23
        $output->writeln($this->getHeader());
24
25
        foreach ($results as $result) {
26
            $output->writeln(\implode(';', ['"' . \strval($result[0]) . '"', $result[1], $result[2], $result[3]]));
27
        }
28
    }
29
30
    /**
31
     * Get the header.
32
     */
33
    private function getHeader(): string
34
    {
35
        return '"File";"Times Changed";"Complexity";"Score"';
36
    }
37
}
38