2017-11-22 13:51:04 -05:00
|
|
|
<?php
|
|
|
|
|
2018-02-14 16:42:39 -05:00
|
|
|
namespace App\ValueObject;
|
2017-11-22 13:51:04 -05:00
|
|
|
|
|
|
|
class Money {
|
|
|
|
private $value;
|
|
|
|
|
|
|
|
public function __construct($value)
|
|
|
|
{
|
2018-07-23 09:52:00 -04:00
|
|
|
$this->value = (float)str_replace(['$',','], '', $value);
|
2017-11-22 13:51:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getValue()
|
|
|
|
{
|
2018-07-23 09:52:00 -04:00
|
|
|
return (float)str_replace(['$',','], '', $this->value);
|
2017-11-22 13:51:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return (string)$this->getValue();
|
|
|
|
}
|
2018-02-14 16:42:39 -05:00
|
|
|
}
|