Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.