| Total Complexity | 8 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class EventSubscriber implements EventSubscriberInterface |
||
| 17 | { |
||
| 18 | private ?CodeCoverage $coverage; |
||
| 19 | |||
| 20 | private ReportService $reportService; |
||
| 21 | |||
| 22 | 222 | public function __construct(ReportService $reportService, ?CodeCoverage $coverage) |
|
| 23 | { |
||
| 24 | 222 | $this->reportService = $reportService; |
|
| 25 | 222 | $this->coverage = $coverage; |
|
| 26 | } |
||
| 27 | |||
| 28 | 37 | public static function getSubscribedEvents(): array |
|
| 36 | 37 | ]; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Before Scenario/Outline Example hook. |
||
| 41 | */ |
||
| 42 | 74 | public function beforeScenario(ScenarioTested $event): void |
|
| 43 | { |
||
| 44 | 74 | if (!$this->coverage) { |
|
| 45 | 37 | return; |
|
| 46 | } |
||
| 47 | |||
| 48 | 37 | $node = $event->getScenario(); |
|
| 49 | 37 | $id = $event->getFeature()->getFile() . ':' . $node->getLine(); |
|
| 50 | |||
| 51 | 37 | $this->coverage->start($id); |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * After Scenario/Outline Example hook. |
||
| 56 | */ |
||
| 57 | 109 | public function afterScenario(ScenarioTested $event): void |
|
|
|
|||
| 58 | { |
||
| 59 | 109 | if (!$this->coverage) { |
|
| 60 | 37 | return; |
|
| 61 | } |
||
| 62 | |||
| 63 | 72 | $this->coverage->stop(); |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * After Exercise hook. |
||
| 68 | */ |
||
| 69 | 74 | public function afterExercise(ExerciseCompleted $event): void |
|
| 76 | } |
||
| 77 | } |
||
| 78 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.