Renombre y cambio de responsabilidad
This commit is contained in:
parent
4c9ef3f782
commit
83dd00858b
2 changed files with 19 additions and 9 deletions
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
class Constants
|
||||
{
|
||||
public const COSTO_TRANSPORTE = 15;
|
||||
public const DIVISOR_TRANSPORTE = 500;
|
||||
}
|
19
app/Utils/TransporteUtils.php
Normal file
19
app/Utils/TransporteUtils.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue