Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
4 / 6
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
UserLevel
66.67% covered (warning)
66.67%
4 / 6
0.00% covered (danger)
0.00%
0 / 1
5.93
0.00% covered (danger)
0.00%
0 / 1
 toString
66.67% covered (warning)
66.67%
4 / 6
0.00% covered (danger)
0.00%
0 / 1
5.93
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\App\Models\Domain;
6
7use PeServer\Core\I18n;
8use PeServer\Core\Text;
9use PeServer\Core\Throws\NotImplementedException;
10
11abstract 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}