2024-03-20 00:00:36 -03:00
|
|
|
<?php
|
|
|
|
|
2024-07-09 21:33:52 -03:00
|
|
|
namespace App\Utils;
|
2024-03-20 00:00:36 -03:00
|
|
|
|
|
|
|
class TransporteUtils
|
|
|
|
{
|
|
|
|
public const COSTO_TRANSPORTE = 15;
|
|
|
|
public const DIVISOR_TRANSPORTE = 500;
|
|
|
|
|
2024-07-09 21:33:52 -03:00
|
|
|
private static function cantidad(float $total) : int {
|
2024-03-20 00:00:36 -03:00
|
|
|
if ($total)
|
2024-07-09 21:33:52 -03:00
|
|
|
return 1 + floor($total / TransporteUtils::DIVISOR_TRANSPORTE);
|
2024-03-20 00:00:36 -03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-07-09 21:33:52 -03:00
|
|
|
public static function calcularTotal(float $total) : int {
|
|
|
|
return TransporteUtils::cantidad($total) * TransporteUtils::COSTO_TRANSPORTE;
|
2024-03-20 00:00:36 -03:00
|
|
|
}
|
|
|
|
}
|