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