Lines 100.00% 5 / 5
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 update 100.00% 4 / 4 100.00% 1 / 1 5
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}