mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-09 07:33:06 -06:00
29 lines
542 B
PHP
29 lines
542 B
PHP
<?php
|
|
declare(strict_types = 1);
|
|
namespace FireflyIII\Helpers\Csv\Converter;
|
|
|
|
/**
|
|
* Class AmountComma
|
|
*
|
|
* Parses the input as the amount with a comma as decimal separator
|
|
*
|
|
* @package FireflyIII\Helpers\Csv\Converter
|
|
*/
|
|
class AmountComma extends BasicConverter implements ConverterInterface
|
|
{
|
|
|
|
/**
|
|
* @return float|int
|
|
*/
|
|
public function convert()
|
|
{
|
|
$value = str_replace(',', '.', $this->value);
|
|
|
|
if (is_numeric($value)) {
|
|
return floatval($value);
|
|
}
|
|
|
|
return '0';
|
|
}
|
|
}
|