Created
June 8, 2016 20:37
-
-
Save Mulkave/7672b8e1da1c84694dfe59cc8be69496 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 | |
namespace Directory\Data\Entities\Citizen\Values; | |
use Directory\Foundation\Value; | |
use Directory\Foundation\Validation; | |
use Directory\Data\Entities\Citizen\Values\Exceptions\InvalidCitizenEmailException; | |
class Email extends Value | |
{ | |
public function __construct($email) | |
{ | |
$rules = [‘email’ => ‘email’]; | |
$validation = $this->validation(compact(‘email’), $rules); | |
if ($validation->fails()) { | |
throw new InvalidCitizenEmailException($email); | |
} | |
$this->setValue($email); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment