Lines
100.00%
2 / 2
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| __toString | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 10 | final readonly class DamageVariance implements Stringable | |
| 11 | { | |
| 12 | /** @var int<0, 100> */ | |
| 13 | public int $percent; | |
| 14 | ||
| 15 | public function __construct(int $percent) | |
| 16 | { | |
| 17 | $this->percent = Type\int_range(min: 0, max: 100)->assert($percent); | |
| 18 | } | |
| 19 | ||
| 20 | public function __toString(): string | |
| 21 | { | |
| 22 | return "{$this->percent}%"; | |
| 23 | } | |
| 24 | } |