forked from bmitch/churn-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAfterFileAnalysisChannel.php
More file actions
48 lines (42 loc) · 1.16 KB
/
AfterFileAnalysisChannel.php
File metadata and controls
48 lines (42 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace Churn\Event\Channel;
use Churn\Event\Channel;
use Churn\Event\Event\AfterFileAnalysis as AfterFileAnalysisEvent;
use Churn\Event\Subscriber\AfterFileAnalysis;
use Closure;
/**
* @internal
* @implements Channel<AfterFileAnalysis, AfterFileAnalysisEvent>
*/
final class AfterFileAnalysisChannel implements Channel
{
/**
* @param object $subscriber A subscriber instance.
*/
#[\Override]
public function accepts($subscriber): bool
{
return $subscriber instanceof AfterFileAnalysis;
}
/**
* @psalm-return class-string<AfterFileAnalysisEvent>
*/
#[\Override]
public function getEventClassname(): string
{
return AfterFileAnalysisEvent::class;
}
/**
* @param object $subscriber A subscriber instance.
* @psalm-param AfterFileAnalysis $subscriber
* @psalm-return Closure(AfterFileAnalysisEvent): void
*/
#[\Override]
public function buildEventHandler($subscriber): Closure
{
return static function (AfterFileAnalysisEvent $event) use ($subscriber): void {
$subscriber->onAfterFileAnalysis($event);
};
}
}