Lines
100.00%
3 / 3
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Powers | 100.00% | 3 / 3 | 100.00% | 2 / 2 | 4 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| update | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 3 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Core\Game\Attribute\Stat\Power; | |
| 6 | ||
| 7 | final class Powers | |
| 8 | { | |
| 9 | public function __construct( | |
| 10 | public private(set) AttackPower $attack = new AttackPower(0), | |
| 11 | public private(set) SpellPower $spell = new SpellPower(0), | |
| 12 | ) {} | |
| 13 | ||
| 14 | /** @mago-expect analysis:match-not-exhaustive */ | |
| 15 | public function update(Power $stat): void | |
| 16 | { | |
| 17 | match (true) { | |
| 18 | $stat instanceof AttackPower => $this->attack = $stat, | |
| 19 | $stat instanceof SpellPower => $this->spell = $stat, | |
| 20 | }; | |
| 21 | } | |
| 22 | } |