Total Complexity | 7 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 68.75% |
Changes | 0 |
1 | <?php |
||
7 | final class SendableRange |
||
8 | { |
||
9 | /** @var int 100 Minimum in msat (sat/1000) */ |
||
10 | private const DEFAULT_MIN_SENDABLE_IN_MILLISATS = 100_000; |
||
|
|||
11 | |||
12 | /** @var int 10 000 000 Maximum in msat (sat/1000) */ |
||
13 | private const DEFAULT_MAX_SENDABLE_IN_MILLISATS = 10_000_000_000; |
||
14 | |||
15 | 5 | private function __construct( |
|
16 | private int $min, |
||
17 | private int $max, |
||
18 | ) { |
||
19 | 5 | } |
|
20 | |||
21 | public static function default(): self |
||
22 | { |
||
23 | return self::withMinMax( |
||
24 | self::DEFAULT_MIN_SENDABLE_IN_MILLISATS, |
||
25 | self::DEFAULT_MAX_SENDABLE_IN_MILLISATS, |
||
26 | ); |
||
27 | } |
||
28 | |||
29 | 5 | public static function withMinMax(int $min, int $max): self |
|
30 | { |
||
31 | 5 | return new self($min, $max); |
|
32 | } |
||
33 | |||
34 | 3 | public function contains(int $amount): bool |
|
35 | { |
||
36 | 3 | return $amount >= $this->min |
|
37 | 3 | && $amount <= $this->max; |
|
38 | } |
||
39 | |||
40 | 1 | public function min(): int |
|
43 | } |
||
44 | |||
45 | 1 | public function max(): int |
|
46 | { |
||
48 | } |
||
49 | } |
||
50 |