Completed
Push — master ( 137204...824e9d )
by Alec
08:58
created

Formatter   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 wrongFormattableType() 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\Formattable;
7
use AlecRabbit\Tools\Reports\Formatters\Contracts\FormatterInterface;
8
use function AlecRabbit\typeOf;
9
10
abstract class Formatter implements FormatterInterface, Strings
11
{
12
    /** {@inheritdoc} */
13
    abstract public function process(Formattable $formattable): string;
14
15
    /**
16
     * @param string $expected
17
     * @param Formattable $formattable
18
     * @throws \RuntimeException
19
     */
20 5
    protected function wrongFormattableType(string $expected, Formattable $formattable): void
21
    {
22 5
        throw new \RuntimeException(
23 5
            'Instance of [' . $expected . '] expected, [' . typeOf($formattable) . '] given.'
24
        );
25
    }
26
}
27