Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
UserRole
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
2 / 2
8
100.00% covered (success)
100.00%
1 / 1
 cssClass
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
4
 label
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3declare(strict_types=1);
4
5namespace App\Enum;
6
7enum UserRole: string
8{
9    case USER = 'ROLE_USER';
10    case AGENT = 'ROLE_AGENT';
11    case ADMIN = 'ROLE_ADMIN';
12
13    public function cssClass(): string
14    {
15        return match ($this) {
16            self::USER => 'badge bg-secondary',
17            self::AGENT => 'badge bg-secondaryx',
18            self::ADMIN => 'badge bg-danger',
19        };
20    }
21
22    public function label(): string
23    {
24        return match ($this) {
25            self::ADMIN => 'Administrator',
26            self::AGENT => 'Agent',
27            self::USER => 'User',
28        };
29    }
30}