HalfOddAdapter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
eloc 7
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A determineCarry() 0 9 5
1
<?php
2
3
namespace Samsara\Fermat\Core\Provider\RoundingModeAdapters\Modes;
4
5
/**
6
 *
7
 */
8
class HalfOddAdapter extends BaseAdapter
9
{
10
11
    /**
12
     * @inheritDoc
13
     */
14 40
    public function determineCarry(int $digit, int $nextDigit): int
15
    {
16 40
        $early = static::nonHalfEarlyReturn($digit);
17 40
        $remainder = $this->remainderCheck();
18
19 40
        if ($early == 0) {
20 24
            return ($nextDigit % 2 == 1 && !$remainder) ? 0 : 1;
21
        } else {
22 16
            return $early == 1 ? 1 : 0;
23
        }
24
    }
25
}