Limpieza de input de valor y filtro de datos a nivel Repo
This commit is contained in:
13
app/src/Service/Valor.php
Normal file
13
app/src/Service/Valor.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Incoviba\Service;
|
||||
|
||||
class Valor
|
||||
{
|
||||
public function clean(string|float|int $value): float
|
||||
{
|
||||
if ((float) $value == $value) {
|
||||
return (float) $value;
|
||||
}
|
||||
return (float) str_replace(['.', ','], ['', '.'], $value);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user