| Conditions | 3 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.2746 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 1 | public function determineCarry(int $digit, int $nextDigit): int |
|
| 18 | { |
||
| 19 | 1 | $remainder = $this->remainder; |
|
| 20 | |||
| 21 | 1 | if (is_null($remainder)) { |
|
| 22 | $target = $digit; |
||
| 23 | $rangeMin = 0; |
||
| 24 | $rangeMax = 9; |
||
| 25 | } else { |
||
| 26 | 1 | $remainder = substr($remainder, 0, 3); |
|
| 27 | 1 | $target = (int)($digit.$remainder); |
|
| 28 | 1 | $rangeMin = 0; |
|
| 29 | 1 | $rangeMax = (int)str_repeat('9', strlen($remainder) + 1); |
|
| 30 | } |
||
| 31 | |||
| 32 | 1 | $random = RandomProvider::randomInt($rangeMin, $rangeMax, RandomMode::Speed)->asInt(); |
|
| 33 | |||
| 34 | 1 | if ($random < $target) { |
|
| 35 | 1 | return 1; |
|
| 36 | } else { |
||
| 37 | 1 | return 0; |
|
| 38 | } |
||
| 40 | } |