collection-crud/src/ValueObject/Money.php

23 lines
338 B
PHP

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