HalfUpAdapter   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

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