Lines 100.00% 5 / 5
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Resistances 100.00% 5 / 5 100.00% 2 / 2 6 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 update 100.00% 4 / 4 100.00% 1 / 1 5
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Core\Game\Attribute\Stat\Resistance;
6
7final class Resistances
8{
9    public function __construct(
10        public private(set) DamageResistance $damage = new DamageResistance(0.0),
11        public private(set) PhysicalResistance $physical = new PhysicalResistance(0.0),
12        public private(set) MagicalResistance $magical = new MagicalResistance(0.0),
13        public private(set) DotResistance $dot = new DotResistance(0.0),
14    ) {}
15
16    /** @mago-expect analysis:match-not-exhaustive */
17    public function update(Resistance $stat): void
18    {
19        match (true) {
20            $stat instanceof DamageResistance => $this->damage = $stat,
21            $stat instanceof PhysicalResistance => $this->physical = $stat,
22            $stat instanceof MagicalResistance => $this->magical = $stat,
23            $stat instanceof DotResistance => $this->dot = $stat,
24        };
25    }
26}