Basic user management
This commit is contained in:
1 parent
e280fcfba8
commit
11108bdfcc
55 files changed
+1524
-54
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\ValueObjects;
|
||||
|
||||
class EmailAddress {
|
||||
private string $value;
|
||||
public static function fromString(string $value) : EmailAddress {
|
||||
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new \InvalidArgumentException("Invalid email address: $value");
|
||||
}
|
||||
|
||||
$emailAddress = new EmailAddress();
|
||||
$emailAddress->setValue($value);
|
||||
return $emailAddress;
|
||||
}
|
||||
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setValue(string $value): void
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user