szurubooru/src/Services/EmailService.php

16 lines
303 B
PHP
Raw Normal View History

2014-08-31 16:57:59 +02:00
<?php
namespace Szurubooru\Services;
class EmailService
{
2014-09-01 19:43:49 +02:00
//todo: refactor this to generic validation
2014-08-31 16:57:59 +02:00
public function validateEmail($email)
{
if (!$email)
return;
if (!preg_match('/^[^@]+@[^@]+\.\w+$/', $email))
throw new \DomainException('Specified e-mail appears to be invalid.');
}
}