Lines 100.00% 2 / 2
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Progress 100.00% 2 / 2 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 ratio 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Client\Script;
6
7final readonly class Progress implements Instruction
8{
9    /**
10     * @param non-negative-int $done
11     * @param positive-int $total
12     */
13    public function __construct(
14        public int $done,
15        public int $total,
16    ) {}
17
18    public function ratio(): float
19    {
20        return min(1.0, $this->done / $this->total);
21    }
22}