unkown commit

This commit is contained in:
m.jalmoudy
2025-12-02 19:39:58 +03:30
parent dfb0658064
commit ed5a490387
27 changed files with 1200 additions and 114 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace DistributingCarriers\Domain\ValueObjects;
use DistributingCarriers\Infrastructure\Exceptions\DomainException;
final class Email
{
private string $value;
public function __construct(string $email)
{
$email = strtolower(trim($email));
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new DomainException("Invalid email address: {$email}");
}
$this->value = $email;
}
public function getValue(): string
{
return $this->value;
}
public function __toString(): string
{
return $this->value;
}
public function equals(Email $other): bool
{
return $this->value === $other->value;
}
}