Lines 100.00% 5 / 5
Methods 100.00% 3 / 3
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 image 100.00% 1 / 1 100.00% 1 / 1 1
 label 100.00% 3 / 3 100.00% 1 / 1 2
10final readonly class CustomMedalTier
11{
12    public function __construct(
13        public CustomMedal $medal,
14        public string $tier,
15    ) {
16    }
17
18    public function image(): string
19    {
20        return $this->medal->image($this->tier);
21    }
22
23    public function label(): string
24    {
25        if ('' === $this->tier) {
26            return $this->medal->title;
27        }
28
29        // "black" is onyx, as everywhere else
30        return \sprintf('%s (%s)', $this->medal->title, Medal::TIERS[$this->tier] ?? \ucfirst($this->tier));
31    }
32}