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

BeforeAnalysisHookDecorator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A onBeforeAnalysis() 0 3 1
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