Passed
Push — master ( 34c1e4...428dea )
by Alec
03:16
created

BenchmarkReportFormatter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getString() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlecRabbit\Tools\Reports\Formatters;
6
7
use AlecRabbit\Tools\Internal\BenchmarkFunction;
8
use AlecRabbit\Tools\Reports\BenchmarkReport;
9
10
class BenchmarkReportFormatter extends ReportFormatter
11
{
12
    /** @var BenchmarkReport */
13
    protected $report;
14
15
    /**
16
     * {@inheritdoc}
17
     */
18 4
    public function getString(): string
19
    {
20 4
        $r = 'Benchmark:' . PHP_EOL;
21
        /** @var BenchmarkFunction $function */
22 4
        foreach ($this->report->getFunctions() as $name => $function) {
23 4
            $r .= (new  BenchmarkFunctionFormatter($function))->getString();
24
        }
25
        return
26 4
            $r . PHP_EOL .
27 4
            $this->report->getMemoryUsageReport() . PHP_EOL .
28 4
            $this->report->getProfiler()->getReport();
29
    }
30
}
31