BeforeAnalysisHookDecorator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 2
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A onBeforeAnalysis() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Subscriber;
6
7
use Churn\Event\Event\BeforeAnalysis as BeforeAnalysisEvent;
8
9
/**
10
 * @internal
11
 * @implements HookDecorator<\Churn\Event\Hook\BeforeAnalysisHook>
12
 */
13
final class BeforeAnalysisHookDecorator implements BeforeAnalysis, HookDecorator
14
{
15
    /**
16
     * @var string
17
     * @psalm-var class-string<\Churn\Event\Hook\BeforeAnalysisHook>
18
     */
19
    private $hook;
20
21
    /**
22
     * @param string $hook The user-defined hook class name.
23
     * @psalm-param class-string<\Churn\Event\Hook\BeforeAnalysisHook> $hook
24
     */
25
    public function __construct(string $hook)
26
    {
27
        $this->hook = $hook;
28
    }
29
30
    /**
31
     * @param BeforeAnalysisEvent $event The event triggered when the analysis starts.
32
     */
33
    #[\Override]
34
    public function onBeforeAnalysis(BeforeAnalysisEvent $event): void
35
    {
36
        $this->hook::beforeAnalysis($event);
37
    }
38
}
39