Skip to content

Instantly share code, notes, and snippets.

@Mulkave
Created June 8, 2016 20:37
Show Gist options
  • Save Mulkave/7672b8e1da1c84694dfe59cc8be69496 to your computer and use it in GitHub Desktop.
Save Mulkave/7672b8e1da1c84694dfe59cc8be69496 to your computer and use it in GitHub Desktop.
<?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