| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function preparing(Promised $started, Promised $stopping) : Promised |
||
| 34 | { |
||
| 35 | $starts = []; |
||
| 36 | |||
| 37 | foreach ($this->dr()->servers() as $api) { |
||
| 38 | foreach ($this->dr()->services($api) as $service => $route) { |
||
| 39 | // set global instance of service |
||
| 40 | DI::set($class = $route[1], $server = DI::object($class)); |
||
| 41 | // lifecycle hooks |
||
| 42 | if ($server instanceof Lifecycle) { |
||
| 43 | $starts[] = $started->then([$server, 'started']); |
||
| 44 | $stopping->then([$server, 'stopped']); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | return all(...$starts); |
||
| 50 | } |
||
| 52 |