Total Complexity | 7 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class Report implements EventSubscriberInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var ReportProcessorInterface[] |
||
13 | */ |
||
14 | private $processors = []; |
||
15 | |||
16 | 1 | public static function getSubscribedEvents() |
|
17 | { |
||
18 | return [ |
||
19 | 1 | CoverageEvent::report => 'generate' |
|
20 | ]; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @return ReportProcessorInterface[] |
||
25 | */ |
||
26 | 1 | public function getProcessors(): array |
|
27 | { |
||
28 | 1 | return $this->processors; |
|
29 | } |
||
30 | |||
31 | 2 | public function addProcessor(ReportProcessorInterface $processor) |
|
32 | { |
||
33 | 2 | $type = $processor->getType(); |
|
34 | 2 | if(!$this->hasProcessor($type)){ |
|
35 | 2 | $this->processors[$type] = $processor; |
|
36 | } |
||
37 | } |
||
38 | |||
39 | 2 | public function hasProcessor(string $type): bool |
|
42 | } |
||
43 | |||
44 | 1 | public function generate(CoverageEvent $event) |
|
51 | } |
||
52 | } |
||
53 | } |
||
54 |