class UnitSolver | class UnitSolver | ||||
{ | { | ||||
public function getWeight(UnitInterface $unit, int $quantityProduct, int $quantity){ | |||||
return ($quantityProduct / $unit->getCoefficient()) * $quantity; | |||||
public function getWeight(UnitInterface $unit, int $quantityProduct, ?int $quantity){ | |||||
if($quantity) { | |||||
return ($quantityProduct / $unit->getCoefficient()) * $quantity; | |||||
}else{ | |||||
$quantity = 0; | |||||
} | |||||
} | } | ||||