collection-crud/src/ValueObject/Money.php

23 lines
338 B
PHP
Raw Normal View History

<?php
namespace App\ValueObject;
class Money {
private $value;
public function __construct($value)
{
2018-07-23 09:52:00 -04:00
$this->value = (float)str_replace(['$',','], '', $value);
}
public function getValue()
{
2018-07-23 09:52:00 -04:00
return (float)str_replace(['$',','], '', $this->value);
}
public function __toString()
{
return (string)$this->getValue();
}
}