mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 05:35:08 +08:00
38 lines
735 B
PHP
38 lines
735 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Email.php@Pay
|
||
|
|
*
|
||
|
|
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
|
||
|
|
* Powered by PhpStorm
|
||
|
|
* Created on 2025/11/28
|
||
|
|
*/
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Singularity\HDK\Pay\Domain\Account\ValueObject;
|
||
|
|
|
||
|
|
use Singularity\HDK\Pay\Domain\ValueObject;
|
||
|
|
|
||
|
|
final class Email extends ValueObject
|
||
|
|
{
|
||
|
|
private string $email;
|
||
|
|
|
||
|
|
public function __construct(string $email)
|
||
|
|
{
|
||
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||
|
|
throw new \InvalidArgumentException('Invalid email address: ' . $email);
|
||
|
|
}
|
||
|
|
|
||
|
|
$this->email = $email;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getValue(): string
|
||
|
|
{
|
||
|
|
return $this->email;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function __toString(): string
|
||
|
|
{
|
||
|
|
return $this->email;
|
||
|
|
}
|
||
|
|
}
|