| Total Complexity | 12 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class IntegerValue implements \Stringable |
||
| 8 | { |
||
| 9 | 32 | final public function __construct( |
|
| 13 | 29 | } |
|
| 14 | |||
| 15 | 28 | public function get(): int |
|
| 16 | { |
||
| 17 | 28 | return $this->value; |
|
| 18 | } |
||
| 19 | |||
| 20 | 3 | 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 | 8 | public function isGreaterThan(self $value): bool |
|
| 31 | { |
||
| 32 | 8 | return $this->value > $value->get(); |
|
| 33 | } |
||
| 34 | |||
| 35 | 4 | public function isGreaterThanOrEqual(self $value): bool |
|
| 36 | { |
||
| 37 | 4 | return $this->value >= $value->get(); |
|
| 38 | } |
||
| 39 | |||
| 40 | 3 | public function diff(self $value): static |
|
| 41 | { |
||
| 42 | 3 | return new static(abs($this->value - $value->get())); |
|
|
|
|||
| 43 | } |
||
| 44 | |||
| 45 | 5 | public function increment(): static |
|
| 46 | { |
||
| 47 | 5 | $this->value += 1; |
|
| 48 | |||
| 49 | 5 | return $this; |
|
| 50 | } |
||
| 51 | |||
| 52 | 5 | public function increaseBy(self $value): static |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public function __toString(): string |
|
| 60 | { |
||
| 61 | 1 | return (string) $this->value; |
|
| 62 | } |
||
| 63 | |||
| 64 | 23 | protected function validate(): void |
|
| 68 | } |
||
| 69 | 22 | } |
|
| 70 | } |
||
| 71 |