Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DashboardRole | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
72 | |
0.00% |
0 / 1 |
| label | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
| fromSystemRole | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Analytics\Domain\Enums; |
| 6 | |
| 7 | use ImovelZapAi\Authentication\Domain\Enums\SystemRole; |
| 8 | |
| 9 | enum DashboardRole: string |
| 10 | { |
| 11 | case Broker = 'broker'; |
| 12 | case Manager = 'manager'; |
| 13 | case Owner = 'owner'; |
| 14 | |
| 15 | public function label(): string |
| 16 | { |
| 17 | return match ($this) { |
| 18 | self::Broker => 'Corretor', |
| 19 | self::Manager => 'Gestor', |
| 20 | self::Owner => 'Proprietário', |
| 21 | }; |
| 22 | } |
| 23 | |
| 24 | public static function fromSystemRole(SystemRole $role): self |
| 25 | { |
| 26 | return match ($role) { |
| 27 | SystemRole::Corretor => self::Broker, |
| 28 | SystemRole::Gestor => self::Manager, |
| 29 | SystemRole::Admin => self::Owner, |
| 30 | }; |
| 31 | } |
| 32 | } |