collection-crud/src/ValueObject/Money.php

23 lines
324 B
PHP

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