| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 51 | public function channels(array $channels, callable $listener) |
||
| 52 | { |
||
| 53 | $promises = []; |
||
| 54 | foreach ($channels as $channel) { |
||
| 55 | $deferred = new Deferred(); |
||
| 56 | $this->client->channel($channel)->subscribe( |
||
| 57 | new CallbackObserver( |
||
| 58 | $listener, |
||
| 59 | null, |
||
| 60 | function () use ($deferred) { |
||
| 61 | $deferred->resolve(); |
||
| 62 | } |
||
| 63 | ) |
||
| 64 | ); |
||
| 65 | $promises[] = $deferred->promise(); |
||
| 66 | } |
||
| 67 | |||
| 68 | await( |
||
| 69 | all($promises), |
||
| 70 | $this->loop |
||
| 71 | ); |
||
| 72 | } |
||
| 73 | } |
||
| 74 |