Lines
100.00%
6 / 6
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| image | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 5 | ||
| 11 | final readonly class CustomMedal | |
| 12 | { | |
| 13 | /** | |
| 14 | * @param string $group anomaly, annual or event | |
| 15 | * @param list<string> $tiers the tiers in 4e's order, empty for a medal without tiers | |
| 16 | */ | |
| 17 | public function __construct( | |
| 18 | public string $group, | |
| 19 | public string $key, | |
| 20 | public string $title, | |
| 21 | public array $tiers = [], | |
| 22 | ) { | |
| 23 | } | |
| 24 | ||
| 25 | /** The image for [$tier] ("" for none), as MedalChecker::getBadgeName. */ | |
| 26 | public function image(string $tier): string | |
| 27 | { | |
| 28 | $suffix = '' === $tier ? '' : '_'.$tier; | |
| 29 | ||
| 30 | return 'custom_medals/'.match ($this->group) { | |
| 31 | 'anomaly' => 'anomaly_'.$this->key.$suffix, | |
| 32 | 'event' => 'event_badge_'.$this->key.$suffix, | |
| 33 | default => 'badge_'.$this->key.$suffix, | |
| 34 | }.'.webp'; | |
| 35 | } | |
| 36 | } |