Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
4 / 6 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
UserLevel | |
66.67% |
4 / 6 |
|
0.00% |
0 / 1 |
5.93 | |
0.00% |
0 / 1 |
toString | |
66.67% |
4 / 6 |
|
0.00% |
0 / 1 |
5.93 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models\Domain; |
6 | |
7 | use PeServer\Core\I18n; |
8 | use PeServer\Core\Text; |
9 | use PeServer\Core\Throws\NotImplementedException; |
10 | |
11 | abstract class UserLevel |
12 | { |
13 | public const UNKNOWN = Text::EMPTY; |
14 | public const USER = 'user'; |
15 | public const SETUP = 'setup'; |
16 | public const ADMINISTRATOR = 'administrator'; |
17 | |
18 | public static function toString(string $userLevel): string |
19 | { |
20 | return match ($userLevel) { |
21 | self::USER => I18n::message('enum/user_level/user'), |
22 | self::SETUP => I18n::message('enum/user_level/setup'), |
23 | self::ADMINISTRATOR => I18n::message('enum/user_level/administrator'), |
24 | default => throw new NotImplementedException() |
25 | }; |
26 | } |
27 | } |