Total Complexity | 6 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | abstract class BaseAdapter |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @param bool $isNegative |
||
13 | * @param string|null $remainder |
||
14 | */ |
||
15 | 13 | public function __construct(protected bool $isNegative, protected ?string $remainder) {} |
|
16 | |||
17 | /** |
||
18 | * @param bool $isNegative |
||
19 | * @return $this |
||
20 | */ |
||
21 | 854 | public function setNegative(bool $isNegative): BaseAdapter |
|
22 | { |
||
23 | 854 | $this->isNegative = $isNegative; |
|
24 | |||
25 | 854 | return $this; |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string|null $remainder |
||
30 | * @return $this |
||
31 | */ |
||
32 | 854 | public function setRemainder(?string $remainder): BaseAdapter |
|
33 | { |
||
34 | 854 | $this->remainder = $remainder; |
|
35 | |||
36 | 854 | return $this; |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return bool |
||
41 | */ |
||
42 | 820 | protected function remainderCheck(): bool |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param int $digit |
||
55 | * @return int |
||
56 | */ |
||
57 | 774 | protected static function nonHalfEarlyReturn(int $digit): int |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param int $digit |
||
64 | * @param int $nextDigit |
||
65 | * @return int |
||
66 | */ |
||
67 | abstract public function determineCarry(int $digit, int $nextDigit): int; |
||
68 | |||
69 | } |