Passed
Push — master ( 93e91b...83695f )
by Fabien
02:05
created

BeforeAnalysisHookDecorator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Subscriber;
6
7
use Churn\Event\Event\BeforeAnalysisEvent;
8
9
/**
10
 * @internal
11
 */
12
class BeforeAnalysisHookDecorator implements BeforeAnalysis
13
{
14
15
    /**
16
     * @var string
17
     */
18
    private $hook;
19
20
    /**
21
     * @param string $hook The user-defined hook class name.
22
     */
23
    public function __construct(string $hook)
24
    {
25
        $this->hook = $hook;
26
    }
27
28
    /**
29
     * @param BeforeAnalysisEvent $event The event triggered when the analysis starts.
30
     */
31
    public function onBeforeAnalysis(BeforeAnalysisEvent $event): void
32
    {
33
        \call_user_func([$this->hook, 'beforeAnalysis'], $event);
34
    }
35
}
36