Text   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generateOutputLine() 0 10 3
A output() 0 14 3
1
<?php
2
namespace exussum12\CoverageChecker\Outputs;
3
4
use exussum12\CoverageChecker\Output;
5
6
class Text implements Output
7
{
8
    public function output(array $coverage, float $percent, float $minimumPercent)
9
    {
10
11
        printf("%.2f%% Covered\n", $percent);
12
13
        $output = '';
14
        foreach ($coverage as $filename => $lines) {
15
            $output .= "\n\n'$filename' has no coverage for the following lines:\n";
16
            foreach ($lines as $line => $message) {
17
                $output .= $this->generateOutputLine($line, $message);
18
            }
19
        }
20
21
        echo trim($output) . "\n";
22
    }
23
24
    private function generateOutputLine($line, $message)
25
    {
26
        $output = "Line $line:\n";
27
        if (!empty($message)) {
28
            foreach ($message as $part) {
29
                $output .= "\t$part\n";
30
            }
31
        }
32
33
        return $output . "\n";
34
    }
35
}
36