Created
April 30, 2018 16:21
-
-
Save shadowhand/edbe147b8513575e859bd140f4b50085 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 | |
declare(strict_types=1); | |
namespace Acme\Domain\Type; | |
use function Assert\that; | |
class EmailAddress | |
{ | |
/** @var string */ | |
private $email; | |
public function __construct(string $email) | |
{ | |
that($email)->email(); | |
$this->email = $email; | |
} | |
public function get(): string | |
{ | |
return $this->email; | |
} | |
public function __toString(): string | |
{ | |
return $this->get(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assert package: https://github.com/beberlei/assert