AfterFileAnalysisChannel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 30
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildEventHandler() 0 5 1
A getEventClassname() 0 4 1
A accepts() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Churn\Event\Channel;
6
7
use Churn\Event\Channel;
8
use Churn\Event\Event\AfterFileAnalysis as AfterFileAnalysisEvent;
9
use Churn\Event\Subscriber\AfterFileAnalysis;
10
use Closure;
11
12
/**
13
 * @internal
14
 * @implements Channel<AfterFileAnalysis, AfterFileAnalysisEvent>
15
 */
16
final class AfterFileAnalysisChannel implements Channel
17
{
18
    /**
19
     * @param object $subscriber A subscriber instance.
20
     */
21
    #[\Override]
22
    public function accepts($subscriber): bool
23
    {
24
        return $subscriber instanceof AfterFileAnalysis;
25
    }
26
27
    /**
28
     * @psalm-return class-string<AfterFileAnalysisEvent>
29
     */
30
    #[\Override]
31
    public function getEventClassname(): string
32
    {
33
        return AfterFileAnalysisEvent::class;
34
    }
35
36
    /**
37
     * @param object $subscriber A subscriber instance.
38
     * @psalm-param AfterFileAnalysis $subscriber
39
     * @psalm-return Closure(AfterFileAnalysisEvent): void
40
     */
41
    #[\Override]
42
    public function buildEventHandler($subscriber): Closure
43
    {
44
        return static function (AfterFileAnalysisEvent $event) use ($subscriber): void {
45
            $subscriber->onAfterFileAnalysis($event);
46
        };
47
    }
48
}
49