2022-06-20 14:47:33 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace D3\LinkmobilityClient\ValueObject;
|
|
|
|
|
|
|
|
use Assert\Assert;
|
|
|
|
|
|
|
|
abstract class StringValueObject extends ValueObject
|
|
|
|
{
|
2022-06-24 14:35:17 +02:00
|
|
|
public function __construct(string $number)
|
2022-06-20 14:47:33 +02:00
|
|
|
{
|
2022-07-13 10:41:23 +02:00
|
|
|
Assert::that($number)->notEmpty();
|
2022-06-20 14:47:33 +02:00
|
|
|
|
2022-06-24 14:35:17 +02:00
|
|
|
$this->value = $number;
|
2022-06-20 14:47:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return $this->get();
|
|
|
|
}
|
|
|
|
|
2022-07-11 15:06:18 +02:00
|
|
|
public function get(): string
|
2022-06-20 14:47:33 +02:00
|
|
|
{
|
|
|
|
return $this->value;
|
|
|
|
}
|
2022-07-12 10:04:04 +02:00
|
|
|
|
|
|
|
public function getFormatted()
|
|
|
|
{
|
|
|
|
return $this->get();
|
|
|
|
}
|
2022-06-20 14:47:33 +02:00
|
|
|
}
|