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