| 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 | 40 | final public function __construct( |
|
| 13 | 37 | } |
|
| 14 | |||
| 15 | 35 | public function get(): int |
|
| 16 | { |
||
| 17 | 35 | return $this->value; |
|
| 18 | } |
||
| 19 | |||
| 20 | 7 | public function equals(self $value): bool |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | public function isLowerThan(self $value): bool |
|
| 26 | { |
||
| 27 | 1 | return $this->value < $value->get(); |
|
| 28 | } |
||
| 29 | |||
| 30 | 9 | public function isGreaterThan(self $value): bool |
|
| 31 | { |
||
| 32 | 9 | return $this->value > $value->get(); |
|
| 33 | } |
||
| 34 | |||
| 35 | 8 | public function isGreaterThanOrEqual(self $value): bool |
|
| 38 | } |
||
| 39 | |||
| 40 | 3 | public function diff(self $value): static |
|
| 43 | } |
||
| 44 | |||
| 45 | 5 | public function increment(): static |
|
| 46 | { |
||
| 47 | 5 | $this->value += 1; |
|
| 48 | 5 | $this->validate(); |
|
| 49 | |||
| 50 | 5 | return $this; |
|
| 51 | } |
||
| 52 | |||
| 53 | 6 | public function increaseBy(self $value): static |
|
| 59 | } |
||
| 60 | |||
| 61 | 1 | public function decreaseBy(self $value): static |
|
| 62 | { |
||
| 63 | 1 | $this->value -= $value->get(); |
|
| 64 | 1 | $this->validate(); |
|
| 65 | |||
| 66 | 1 | return $this; |
|
| 67 | } |
||
| 68 | |||
| 69 | 1 | public function replaceWith(self $value): static |
|
| 70 | { |
||
| 71 | 1 | $this->value = $value->get(); |
|
| 72 | 1 | $this->validate(); |
|
| 73 | |||
| 74 | 1 | return $this; |
|
| 75 | } |
||
| 76 | |||
| 77 | 1 | public function __toString(): string |
|
| 78 | { |
||
| 79 | 1 | return (string) $this->value; |
|
| 80 | } |
||
| 81 | |||
| 82 | 31 | protected function validate(): void |
|
| 86 | } |
||
| 87 | 30 | } |
|
| 88 | } |
||
| 89 |