Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created April 30, 2018 16:21
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 shadowhand/edbe147b8513575e859bd140f4b50085 to your computer and use it in GitHub Desktop.
Save shadowhand/edbe147b8513575e859bd140f4b50085 to your computer and use it in GitHub Desktop.
<?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();
}
}
@shadowhand
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment