1 | <?php |
||
8 | class Event |
||
9 | { |
||
10 | private $dispatcher; |
||
11 | private $filesystem; |
||
12 | private $service; |
||
13 | private $spy; |
||
14 | |||
15 | public function __construct(Dispatcher $dispatcher, Service $service, Spy $spy, Filesystem $filesystem) |
||
16 | { |
||
17 | $this->dispatcher = $dispatcher; |
||
18 | $this->filesystem = $filesystem; |
||
19 | $this->service = $service; |
||
20 | $this->spy = $spy; |
||
21 | } |
||
22 | |||
23 | public function getSubscription() |
||
24 | { |
||
25 | $subscription = []; |
||
26 | foreach ($this->filesystem->listClasses('Listener') as $class) { |
||
27 | $reflection = new ReflectionClass($class); |
||
28 | if ($reflection->isAbstract()) { |
||
29 | continue; |
||
30 | } |
||
31 | foreach ($reflection->getStaticPropertyValue('events') as $event) { |
||
32 | if (!array_key_exists($event, $subscription)) { |
||
33 | $subscription[$event] = []; |
||
34 | } |
||
35 | $subscription[$event][] = substr($class, strlen('Listener\\')); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return $subscription; |
||
40 | } |
||
41 | |||
42 | public function fire(string $event, $context) |
||
49 | |||
50 | public function fireChanges(string $producer) |
||
79 | } |
||
80 |