Lines
0.00%
0 / 4
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| BrokerRunPhase | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 20 | 0.00% | 0 / 1 | |||
| canEnter | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 20 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Lifecycle; | |
| 6 | ||
| 7 | enum BrokerRunPhase | |
| 8 | { | |
| 9 | case Idle; | |
| 10 | case Running; | |
| 11 | case Stopping; | |
| 12 | case Stopped; | |
| 13 | ||
| 14 | public function canEnter(self $next): bool | |
| 15 | { | |
| 16 | return match ($this) { | |
| 17 | self::Idle, self::Stopped => $next === self::Running, | |
| 18 | self::Running => $next === self::Stopping, | |
| 19 | self::Stopping => $next === self::Stopped, | |
| 20 | }; | |
| 21 | } | |
| 22 | } |