Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
7 | trait Reportable |
||
8 | { |
||
9 | /** @var ReportInterface */ |
||
10 | protected $report; |
||
11 | |||
12 | /** |
||
13 | * @param bool $rebuild Rebuild report object |
||
14 | * @return ReportInterface |
||
15 | */ |
||
16 | public function report(bool $rebuild = true): ReportInterface |
||
17 | { |
||
18 | if (true === $rebuild) { |
||
19 | $this->meetConditions(); |
||
20 | $this->beforeReport(); |
||
21 | /** @noinspection PhpParamsInspection */ |
||
22 | $this->report->buildOn($this); |
||
1 ignored issue
–
show
|
|||
23 | } |
||
24 | return |
||
25 | $this->report; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Checks if all conditions needed for report are met |
||
30 | */ |
||
31 | protected function meetConditions(): void |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Makes all necessary actions before report |
||
37 | */ |
||
38 | protected function beforeReport(): void |
||
40 | } |
||
41 | } |
||
42 |