AbstractReport   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 37
ccs 12
cts 12
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 3 1
A __construct() 0 5 1
A extractDataFrom() 0 3 1
A getReportable() 0 3 1
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