AfterAnalysisHookDecorator::onAfterAnalysis()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Subscriber;
6
7
use Churn\Event\Event\AfterAnalysis as AfterAnalysisEvent;
8
9
/**
10
 * @internal
11
 * @implements HookDecorator<\Churn\Event\Hook\AfterAnalysisHook>
12
 */
13
final class AfterAnalysisHookDecorator implements AfterAnalysis, HookDecorator
14
{
15
    /**
16
     * @var string
17
     * @psalm-var class-string<\Churn\Event\Hook\AfterAnalysisHook>
18
     */
19
    private $hook;
20
21
    /**
22
     * @param string $hook The user-defined hook class name.
23
     * @psalm-param class-string<\Churn\Event\Hook\AfterAnalysisHook> $hook
24
     */
25
    public function __construct(string $hook)
26
    {
27
        $this->hook = $hook;
28
    }
29
30
    /**
31
     * @param AfterAnalysisEvent $event The event triggered when the analysis is done.
32
     */
33
    #[\Override]
34
    public function onAfterAnalysis(AfterAnalysisEvent $event): void
35
    {
36
        $this->hook::afterAnalysis($event);
37
    }
38
}
39