| Total Complexity | 10 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | class Operations |
||
| 23 | { |
||
| 24 | private int $amountCols; |
||
| 25 | private int $missing = 0; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var Column[] |
||
| 29 | */ |
||
| 30 | private array $columns; |
||
| 31 | |||
| 32 | public function __construct(Calculator $calculator) |
||
| 33 | { |
||
| 34 | $this->columns = $calculator->getColumns(); |
||
| 35 | $this->amountCols = count($this->columns); |
||
| 36 | |||
| 37 | foreach($this->columns as $col) |
||
| 38 | { |
||
| 39 | if($col->isMissing()) |
||
| 40 | { |
||
| 41 | $this->missing++; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | public function calcTotal() : float |
||
| 47 | { |
||
| 48 | $total = 0; |
||
| 49 | |||
| 50 | foreach($this->columns as $col) |
||
| 51 | { |
||
| 52 | $total += $col->getValue(); |
||
| 53 | } |
||
| 54 | |||
| 55 | return $total; |
||
| 56 | } |
||
| 57 | |||
| 58 | public function countColumns() : int |
||
| 59 | { |
||
| 60 | return $this->amountCols; |
||
| 61 | } |
||
| 62 | |||
| 63 | public function countMissing() : int |
||
| 64 | { |
||
| 65 | return $this->missing; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function calcTotalNotMissing() : float |
||
| 81 | } |
||
| 82 | } |
||
| 83 |