Completed
Push — develop ( a0bdf0...500e55 )
by Alec
02:54
created

ReportFormatter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 13
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A wrongReport() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Tools\Reports\Formatters;
4
5
use AlecRabbit\Tools\Contracts\Strings;
6
use AlecRabbit\Tools\Reports\Contracts\ReportInterface;
7
use AlecRabbit\Tools\Reports\Formatters\Contracts\FormatterInterface;
8
use function AlecRabbit\typeOf;
9
10
abstract class ReportFormatter implements FormatterInterface, Strings
11
{
12
    /** {@inheritdoc} */
13
    abstract public function process(ReportInterface $report): string;
14
15
    /**
16
     * @param string $expected
17
     * @param ReportInterface $report
18
     */
19 1
    protected function wrongReport(string $expected, ReportInterface $report): void
20
    {
21 1
        throw new \RuntimeException(
22 1
            'Instance of [' . $expected . '] expected, [' . typeOf($report) . '] given'
23
        );
24
    }
25
}
26