Passed
Push — master ( 1a5d0e...3dcb8c )
by Alec
01:38
created

AbstractFormatter::errorMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Traits\ForReports\Core;
4
5
use AlecRabbit\Traits\ForReports\Contracts\FormatterInterface;
6
7
abstract class AbstractFormatter implements FormatterInterface
8
{
9
    /** @var int */
10
    protected $options = 0;
11
12
    /** {@inheritDoc} */
13
    public function __construct(?int $options = null)
14
    {
15
        $this->options = $options ?? 0;
16
    }
17
18
    abstract public function process(Formattable $data): string;
19
20
    /**
21
     * @param Formattable $data
22
     * @param string $class
23
     * @return string
24
     */
25
    protected function errorMessage(Formattable $data, string $class): string
26
    {
27
        return
28
            $class . ' expected, ' . get_class($data) . ' given.';
29
    }
30
}
31