Lines 100.00% 8 / 8
Methods 100.00% 4 / 4
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 effective 100.00% 1 / 1 100.00% 1 / 1 1
 describe 100.00% 3 / 3 100.00% 1 / 1 1
 [Lorekeeper\Core\Support\Ratio] __construct 100.00% 3 / 3 100.00% 1 / 1 3
 [Lorekeeper\Core\Support\Ratio] __toString 100.00% 1 / 1 100.00% 1 / 1 1
10final readonly class Haste extends Ratio implements Stat
11{
12    private const float CAP = 0.5;
13
14    public function effective(): float
15    {
16        return min($this->value, self::CAP);
17    }
18
19    #[Override]
20    public function describe(): StatDescription
21    {
22        return new StatDescription(
23            'Haste reduces the cooldown on all of your attacks and spells, including Auto Attack, by a certain percentage (hard capped at 50%).',
24        );
25    }
26}

Inherited from Lorekeeper\Core\Support\Ratio

15    final public function __construct(float $value)
16    {
17        if (!is_finite($value) || $value < 0.0) {
18            throw new InvalidArgumentException("Ratio {$value} is not a finite number of zero or more.");
19        }
20
21        $this->value = $value;
22    }
24    final public function __toString(): string
25    {
26        return (string) $this->value;
27    }