1 | <?php |
||
8 | class Service |
||
9 | { |
||
10 | private $app; |
||
11 | private $cache; |
||
12 | private $name; |
||
13 | |||
14 | public function __construct($name, Application $app, Cache $cache) |
||
20 | |||
21 | 52 | public function getName() : string |
|
25 | |||
26 | private $services; |
||
27 | |||
28 | 1 | public function listServices() : array |
|
32 | |||
33 | 6 | public function subscribe(string $event) |
|
40 | |||
41 | public function unsubscribe(string $event) |
||
48 | |||
49 | private $eventExistence = []; |
||
50 | |||
51 | 1 | public function eventExists(string $event) : bool |
|
52 | { |
||
53 | 1 | if (array_key_exists($event, $this->eventExistence)) { |
|
54 | return $this->eventExistence[$event]; |
||
55 | } |
||
56 | 1 | $types = $this->app->get(Pool::class)->get('event')->find('type'); |
|
57 | |||
58 | 1 | foreach ($types as $type) { |
|
59 | 1 | if (!$type->ignore && $this->eventMatch($event, $type->nick)) { |
|
60 | 1 | return $this->eventExistence[$event] = true; |
|
61 | } |
||
62 | } |
||
63 | |||
64 | 1 | return $this->eventExistence[$event] = false; |
|
65 | } |
||
66 | |||
67 | 2 | public function eventMatch($event, $spec) |
|
82 | |||
83 | 5 | public function getHost($name) |
|
99 | } |
||
100 |