Renombre y cambio de responsabilidad

This commit is contained in:
Alejandro Tasistro 2024-03-20 00:00:36 -03:00
parent 4c9ef3f782
commit 83dd00858b
2 changed files with 19 additions and 9 deletions

View File

@ -1,9 +0,0 @@
<?php
namespace App;
class Constants
{
public const COSTO_TRANSPORTE = 15;
public const DIVISOR_TRANSPORTE = 500;
}

View File

@ -0,0 +1,19 @@
<?php
namespace App;
class TransporteUtils
{
public const COSTO_TRANSPORTE = 15;
public const DIVISOR_TRANSPORTE = 500;
static function cantidad(float $total) : int {
if ($total)
return 1 + floor($total / DIVISOR_TRANSPORTE);
return 0;
}
static function total(float $total) : int {
return cantidad($total) * COSTO_TRANSPORTE;
}
}