change sender to notString value object
This commit is contained in:
parent
7e67bc1818
commit
fe60f1102d
@ -24,7 +24,7 @@ use libphonenumber\NumberParseException;
|
|||||||
use libphonenumber\PhoneNumberFormat;
|
use libphonenumber\PhoneNumberFormat;
|
||||||
use libphonenumber\PhoneNumberUtil;
|
use libphonenumber\PhoneNumberUtil;
|
||||||
|
|
||||||
class Sender extends StringValueObject
|
class Sender extends ValueObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $number
|
* @param string $number
|
||||||
|
@ -19,13 +19,6 @@ use Assert\Assert;
|
|||||||
|
|
||||||
abstract class StringValueObject extends ValueObject
|
abstract class StringValueObject extends ValueObject
|
||||||
{
|
{
|
||||||
public function __construct(string $number)
|
|
||||||
{
|
|
||||||
Assert::that($number)->notEmpty();
|
|
||||||
|
|
||||||
$this->value = $number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return $this->get();
|
return $this->get();
|
||||||
@ -35,9 +28,4 @@ abstract class StringValueObject extends ValueObject
|
|||||||
{
|
{
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormatted()
|
|
||||||
{
|
|
||||||
return $this->get();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,26 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\LinkmobilityClient\ValueObject;
|
namespace D3\LinkmobilityClient\ValueObject;
|
||||||
|
|
||||||
|
use Assert\Assert;
|
||||||
|
|
||||||
abstract class ValueObject
|
abstract class ValueObject
|
||||||
{
|
{
|
||||||
protected $value;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user