change sender to notString value object

This commit is contained in:
Daniel Seifert 2022-07-14 16:06:33 +02:00
parent 7e67bc1818
commit fe60f1102d
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
3 changed files with 20 additions and 13 deletions

View File

@ -24,7 +24,7 @@ use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberUtil;
class Sender extends StringValueObject
class Sender extends ValueObject
{
/**
* @param string $number

View File

@ -19,13 +19,6 @@ use Assert\Assert;
abstract class StringValueObject extends ValueObject
{
public function __construct(string $number)
{
Assert::that($number)->notEmpty();
$this->value = $number;
}
public function __toString()
{
return $this->get();
@ -35,9 +28,4 @@ abstract class StringValueObject extends ValueObject
{
return $this->value;
}
public function getFormatted()
{
return $this->get();
}
}

View File

@ -15,7 +15,26 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\ValueObject;
use Assert\Assert;
abstract class ValueObject
{
protected $value;
public function __construct(string $number)
{
Assert::that($number)->notEmpty();
$this->value = $number;
}
public function get()
{
return $this->value;
}
public function getFormatted()
{
return $this->get();
}
}