| Conditions | 2 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0185 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 1 | public function subscribe(string $subscribedTopic, callable $callback): PromiseInterface |
|
| 30 | { |
||
| 31 | $this->emitter->on('message', function (string $topic, Message $message) use ($callback, $subscribedTopic) { |
||
| 32 | 1 | if (!TopicMatcher::matchesTopicSelectors($topic, [$subscribedTopic])) { |
|
| 33 | return; |
||
| 34 | } |
||
| 35 | 1 | return $callback($topic, $message); |
|
| 36 | 1 | }); |
|
| 37 | 1 | return resolve($subscribedTopic); |
|
| 38 | } |
||
| 40 |