szurubooru/src/Services/EmailService.php
2014-10-18 18:48:17 +02:00

15 lines
303 B
PHP

<?php
namespace Szurubooru\Services;
class EmailService
{
//todo: refactor this to generic validation
public function validateEmail($email)
{
if (!$email)
return;
if (!preg_match('/^[^@]+@[^@]+\.\w+$/', $email))
throw new \DomainException('Specified e-mail appears to be invalid.');
}
}