Passed
Push — develop ( 0a2c3f...8e5858 )
by Alec
03:05
created

ReportFormatter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A wrongReportType() 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
     * @throws \RuntimeException
19
     */
20 2
    protected function wrongReportType(string $expected, ReportInterface $report): void
21
    {
22 2
        throw new \RuntimeException(
23 2
            'Instance of [' . $expected . '] expected, [' . typeOf($report) . '] given.'
24
        );
25
    }
26
}
27