|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Lc\CaracoleBundle\Solver\Config; |
|
|
namespace Lc\CaracoleBundle\Solver\Config; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Lc\CaracoleBundle\Model\Config\UnitInterface; |
|
|
use Lc\CaracoleBundle\Model\Config\UnitInterface; |
|
|
|
|
|
|
|
|
class UnitSolver |
|
|
class UnitSolver |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
public function getWeight(UnitInterface $unit, float $quantityProduct, ?int $quantity){ |
|
|
|
|
|
if($quantity) { |
|
|
|
|
|
|
|
|
public function getWeight(UnitInterface $unit, float $quantityProduct, ?float $quantity) |
|
|
|
|
|
{ |
|
|
|
|
|
if ($quantity) { |
|
|
return ($quantityProduct / $unit->getCoefficient()) * $quantity; |
|
|
return ($quantityProduct / $unit->getCoefficient()) * $quantity; |
|
|
}else{ |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |