Completed
Push — develop ( f10e50...4f888d )
by Alec
03:20
created

Reportable::prepareForReport()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * User: alec
4
 * Date: 01.12.18
5
 * Time: 20:25
6
 */
7
8
namespace AlecRabbit\Tools\Reports\Traits;
9
10
use AlecRabbit\Tools\Reports\Contracts\ReportInterface;
11
use AlecRabbit\Tools\Reports\ReportFactory;
12
13
trait Reportable
14
{
15
16
    protected $reportObject;
17
18
    /**
19
     * @return ReportInterface
20
     */
21 8
    public function report(): ReportInterface
22
    {
23 8
        if (null === $this->reportObject) {
24 8
            $this->prepareForReport();
25 8
            $this->reportObject = ReportFactory::createReport($this);
0 ignored issues
show
Bug introduced by
$this of type AlecRabbit\Tools\Reports\Traits\Reportable is incompatible with the type AlecRabbit\Tools\Reports...cts\ReportableInterface expected by parameter $reportable of AlecRabbit\Tools\Reports...Factory::createReport(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
            $this->reportObject = ReportFactory::createReport(/** @scrutinizer ignore-type */ $this);
Loading history...
26
        }
27
        return
28 8
            $this->reportObject;
29
    }
30
31 6
    protected function prepareForReport(): void
32
    {
33 6
    }
34
}
35