Lines 100.00% 7 / 7
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
PrimaryAttributes 100.00% 7 / 7 100.00% 2 / 2 8 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 update 100.00% 6 / 6 100.00% 1 / 1 7
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Core\Game\Attribute\Stat\Primary;
6
7final class PrimaryAttributes
8{
9    /** @mago-expect lint:excessive-parameter-list */
10    public function __construct(
11        public private(set) Strength $strength = new Strength(0),
12        public private(set) Intellect $intellect = new Intellect(0),
13        public private(set) Dexterity $dexterity = new Dexterity(0),
14        public private(set) Endurance $endurance = new Endurance(0),
15        public private(set) Wisdom $wisdom = new Wisdom(0),
16        public private(set) Luck $luck = new Luck(0),
17    ) {}
18
19    /** @mago-expect analysis:match-not-exhaustive */
20    public function update(PrimaryAttribute $stat): void
21    {
22        match (true) {
23            $stat instanceof Strength => $this->strength = $stat,
24            $stat instanceof Intellect => $this->intellect = $stat,
25            $stat instanceof Dexterity => $this->dexterity = $stat,
26            $stat instanceof Endurance => $this->endurance = $stat,
27            $stat instanceof Wisdom => $this->wisdom = $stat,
28            $stat instanceof Luck => $this->luck = $stat,
29        };
30    }
31}