| Total Complexity | 14 |
| Total Lines | 79 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class IntegerValue implements \Stringable |
||
| 8 | { |
||
| 9 | 52 | final public function __construct( |
|
| 13 | 49 | } |
|
| 14 | |||
| 15 | 49 | public function get(): int |
|
| 16 | { |
||
| 17 | 49 | return $this->value; |
|
| 18 | } |
||
| 19 | |||
| 20 | 10 | public function equals(self $value): bool |
|
| 23 | } |
||
| 24 | |||
| 25 | 9 | public function isLowerThan(self $value): bool |
|
| 26 | { |
||
| 27 | 9 | return $this->value < $value->get(); |
|
| 28 | } |
||
| 29 | |||
| 30 | 14 | public function isGreaterThan(self $value): bool |
|
| 31 | { |
||
| 32 | 14 | return $this->value > $value->get(); |
|
| 33 | } |
||
| 34 | |||
| 35 | 11 | public function isGreaterThanOrEqual(self $value): bool |
|
| 38 | } |
||
| 39 | |||
| 40 | 7 | public function diff(self $value): static |
|
| 43 | } |
||
| 44 | |||
| 45 | 13 | public function increment(): static |
|
| 46 | { |
||
| 47 | 13 | $this->value += 1; |
|
| 48 | 13 | $this->validate(); |
|
| 49 | |||
| 50 | 12 | return $this; |
|
| 51 | } |
||
| 52 | |||
| 53 | 15 | public function increaseBy(self $value): static |
|
| 59 | } |
||
| 60 | |||
| 61 | 6 | public function decreaseBy(self $value): static |
|
| 62 | { |
||
| 63 | 6 | $this->value -= $value->get(); |
|
| 64 | 6 | $this->validate(); |
|
| 65 | |||
| 66 | 4 | return $this; |
|
| 67 | } |
||
| 68 | |||
| 69 | 2 | public function replaceWith(self $value): static |
|
| 70 | { |
||
| 71 | 2 | $this->value = $value->get(); |
|
| 72 | 2 | $this->validate(); |
|
| 73 | |||
| 74 | 2 | return $this; |
|
| 75 | } |
||
| 76 | |||
| 77 | 10 | public function __toString(): string |
|
| 78 | { |
||
| 79 | 10 | return (string) $this->value; |
|
| 80 | } |
||
| 81 | |||
| 82 | 44 | protected function validate(): void |
|
| 86 | } |
||
| 87 | 43 | } |
|
| 88 | } |
||
| 89 |