Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
UserGroup
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
5
100.00% covered (success)
100.00%
1 / 1
 label
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
 isAdmin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace AppDemo\User\Domain;
11
12use Phexium\Domain\EnumInterface;
13use Phexium\Domain\EnumTrait;
14
15enum UserGroup: string implements EnumInterface
16{
17    use EnumTrait;
18
19    case Admin = 'admin';
20    case User = 'user';
21
22    public function label(): string
23    {
24        return match ($this) {
25            self::Admin => 'Administrator',
26            self::User => 'User',
27        };
28    }
29
30    public function isAdmin(): bool
31    {
32        return $this === self::Admin;
33    }
34
35    public function isUser(): bool
36    {
37        return $this === self::User;
38    }
39}