Skip to content

Instantly share code, notes, and snippets.

@thiagocordeiro
Last active August 25, 2020 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagocordeiro/fd52b3aea3cd0c75ed5846803cc43454 to your computer and use it in GitHub Desktop.
Save thiagocordeiro/fd52b3aea3cd0c75ed5846803cc43454 to your computer and use it in GitHub Desktop.
<?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