Passed
Pull Request — main (#5)
by Chema
02:24
created

SendableRange   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A max() 0 3 1
A __construct() 0 4 1
A withMinMax() 0 3 1
A min() 0 3 1
A contains() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightning\Invoice\Domain\Transfer;
6
7
final class SendableRange
8
{
9 6
    private function __construct(
10
        private int $min,
11
        private int $max,
12
    ) {
13 6
    }
14
15 6
    public static function withMinMax(int $min, int $max): self
16
    {
17 6
        return new self($min, $max);
18
    }
19
20 3
    public function contains(int $amount): bool
21
    {
22 3
        return $amount >= $this->min
23 3
            && $amount <= $this->max;
24
    }
25
26 3
    public function min(): int
27
    {
28 3
        return $this->min;
29
    }
30
31 3
    public function max(): int
32
    {
33 3
        return $this->max;
34
    }
35
}
36