Total Complexity | 9 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class IntegerValue implements \Stringable |
||
8 | { |
||
9 | 17 | final public function __construct( |
|
12 | |||
13 | 16 | public function get(): int |
|
16 | } |
||
17 | |||
18 | 1 | public function equals(self $value): bool |
|
19 | { |
||
20 | 1 | return $this->value === $value->get(); |
|
21 | } |
||
22 | |||
23 | 5 | public function isGreaterThan(self $value): bool |
|
24 | { |
||
25 | 5 | return $this->value > $value->get(); |
|
26 | } |
||
27 | |||
28 | 4 | public function isGreaterThanOrEqual(self $value): bool |
|
29 | { |
||
30 | 4 | return $this->value >= $value->get(); |
|
31 | } |
||
32 | |||
33 | 1 | public function diff(self $value): static |
|
34 | { |
||
35 | 1 | return new static($this->value - $value->get()); |
|
36 | } |
||
37 | |||
38 | 5 | public function increment(): static |
|
39 | { |
||
40 | 5 | $this->value += 1; |
|
41 | |||
42 | 5 | return $this; |
|
43 | } |
||
44 | |||
45 | 5 | public function increaseBy(self $value): static |
|
50 | } |
||
51 | |||
52 | 1 | public function __toString(): string |
|
53 | { |
||
54 | 1 | return (string) $this->value; |
|
55 | } |
||
56 | } |
||
57 |