Last active
August 25, 2020 10:14
-
-
Save thiagocordeiro/fd52b3aea3cd0c75ed5846803cc43454 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Email | |
{ | |
private string $email; | |
public function __construct(string $email) | |
{ | |
if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) { | |
throw new Exception('Invalid Email'); | |
} | |
$this->email = $email; | |
} | |
public function getEmail(): string { ... } | |
} | |
class Password | |
{ | |
public function __construct(string $password) { ... } | |
} | |
class RegisterUser | |
{ | |
public function __construct(string $name, Email $email, Password $password) { ... } | |
} | |
class RegisterUserService | |
{ | |
public function register(RegisterUser $registerUser): UserRegistered { ... } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment