Lines 100.00% 9 / 9
Functions and Methods 100.00% 3 / 3
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
ProfilePart 100.00% 9 / 9 100.00% 3 / 3 9 100.00% 1 / 1
 label 100.00% 1 / 1 100.00% 1 / 1 1
 help 100.00% 1 / 1 100.00% 1 / 1 1
 icon 100.00% 7 / 7 100.00% 1 / 1 7
1<?php
2
3declare(strict_types=1);
4
5namespace App\Enum;
6
7/**
8 * A part of the agent profile that a user shows to other users (signed in) or keeps private.
9 * The other parts are only shown together with AGENT: the agent page is found by the agent name.
10 */
11enum ProfilePart: string
12{
13    /** Agent name, faction and level (from the latest stats). */
14    case AGENT = 'agent';
15    case AVATAR = 'avatar';
16    case LATEST_STATS = 'latest_stats';
17    case STATS_HISTORY = 'stats_history';
18    case CUSTOM_MEDALS = 'custom_medals';
19    /** The Bannergress counts and lists the app synced. */
20    case BANNERGRESS = 'bannergress';
21
22    /** A translation key (messages). */
23    public function label(): string
24    {
25        return 'profile_part.'.$this->value.'.label';
26    }
27
28    /** A translation key (messages). */
29    public function help(): string
30    {
31        return 'profile_part.'.$this->value.'.help';
32    }
33
34    /** The Bootstrap icon in the admins' list of users (the app uses the same). */
35    public function icon(): string
36    {
37        return match ($this) {
38            self::AGENT => 'bi-person',
39            self::AVATAR => 'bi-image',
40            self::LATEST_STATS => 'bi-bar-chart',
41            self::STATS_HISTORY => 'bi-clock-history',
42            self::CUSTOM_MEDALS => 'bi-award',
43            self::BANNERGRESS => 'bi-grid-3x3-gap',
44        };
45    }
46}