CsvResultsRenderer::render()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 2
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