Conditions | 4 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | public function fill() : void |
||
46 | { |
||
47 | $leftover = $this->calculator->getMaxTotal() - $this->operations->calcTotal(); |
||
48 | $perCol = $leftover / $this->operations->countColumns(); |
||
49 | |||
50 | if($this->calculator->isIntegerMode()) |
||
51 | { |
||
52 | $perCol = (int)ceil($perCol); |
||
53 | } |
||
54 | |||
55 | for($i=($this->operations->countColumns()-1); $i >=0; $i--) |
||
56 | { |
||
57 | if($leftover <= 0) |
||
58 | { |
||
59 | break; |
||
60 | } |
||
61 | |||
62 | $leftover -= $perCol; |
||
63 | |||
64 | $col = $this->columns[$i]; |
||
65 | |||
66 | $val = $col->getValue() + $perCol; |
||
67 | |||
68 | $col->setValue($val); |
||
69 | } |
||
72 |