Skip to content

Instantly share code, notes, and snippets.

@mdzwigala
Created December 3, 2020 19:44
Show Gist options
  • Save mdzwigala/6494187571151b0e873e5172eba4ab57 to your computer and use it in GitHub Desktop.
Save mdzwigala/6494187571151b0e873e5172eba4ab57 to your computer and use it in GitHub Desktop.
ADR-EXAMPLE/Domain/User
<?php
declare(strict_types=1);
namespace App\Domain\Model;
final class User
{
private string $email;
private string $encodedPassword;
private string $id;
public function __construct(string $email, string $encodedPassword)
{
$this->id = uniqid();
$this->email = $email;
$this->changePassword($encodedPassword);
}
public function id(): string
{
return $this->id;
}
public function email(): string
{
return $this->email;
}
public function changePassword(string $encodedPassword): void
{
$this->encodedPassword = $encodedPassword;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment