AbstractReport::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Reports\Core;
4
5
use AlecRabbit\Formatters\Contracts\FormatterInterface;
6
use AlecRabbit\Reports\Contracts\ReportInterface;
7
8
abstract class AbstractReport extends Formattable implements ReportInterface
9
{
10
    /** @var array */
11
    protected $data;
12
13
    /** @var null|AbstractReportable */
14
    protected $reportable;
15
16 4
    public function __construct(FormatterInterface $formatter = null, AbstractReportable $reportable = null)
17
    {
18 4
        parent::__construct($formatter);
19 4
        $this->reportable = $reportable;
20 4
        $this->extractDataFrom($reportable);
21 4
    }
22
23
    /**
24
     * @param AbstractReportable $reportable
25
     */
26 3
    protected function extractDataFrom(AbstractReportable $reportable = null): void
27
    {
28 3
        $this->data = [];
29 3
    }
30
31
    /**
32
     * @return array
33
     */
34 1
    public function getData(): array
35
    {
36 1
        return $this->data;
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42 2
    public function getReportable()
43
    {
44 2
        return $this->reportable;
45
    }
46
}
47