Lines
0.00%
0 / 3
Functions and Methods
0.00%
0 / 3
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ShutdownHandler | 0.00% | 0 / 3 | 0.00% | 0 / 3 | 12 | 0.00% | 0 / 1 | |||
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| handledMessageClass | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| handle | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Worker\Message; | |
| 6 | ||
| 7 | use Stewart\Runtime\Ipc\Message\BrokerMessage; | |
| 8 | use Stewart\Runtime\Ipc\Message\Shutdown; | |
| 9 | use Stewart\Runtime\Worker\WorkerShutdown; | |
| 10 | ||
| 11 | /** @implements BrokerMessageHandler<Shutdown> */ | |
| 12 | final readonly class ShutdownHandler implements BrokerMessageHandler | |
| 13 | { | |
| 14 | public function __construct(private WorkerShutdown $shutdown) {} | |
| 15 | ||
| 16 | public function handledMessageClass(): string | |
| 17 | { | |
| 18 | return Shutdown::class; | |
| 19 | } | |
| 20 | ||
| 21 | /** @param Shutdown $message */ | |
| 22 | public function handle(BrokerMessage $message): void | |
| 23 | { | |
| 24 | $this->shutdown->stop($message->reason, $message->grace); | |
| 25 | } | |
| 26 | } |