-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathEmailAddress.php
More file actions
45 lines (40 loc) · 1.03 KB
/
Copy pathEmailAddress.php
File metadata and controls
45 lines (40 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* EmailAddress
*
* @category StrokerForm
* @package StrokerForm\Renderer
* @copyright 2012 Bram Gerritsen
* @version SVN: $Id$
*/
namespace StrokerForm\Renderer\JqueryValidate\Rule;
use Zend\Form\ElementInterface;
use Zend\Validator\ValidatorInterface;
use Zend\Validator\EmailAddress as EmailAddressValidator;
class EmailAddress extends AbstractRule
{
/**
* {@inheritDoc}
*/
public function getRules(ValidatorInterface $validator, ElementInterface $element = null)
{
return ['email' => true];
}
/**
* {@inheritDoc}
*/
public function getMessages(ValidatorInterface $validator)
{
return ['email' => $validator->getMessageTemplates()[\Zend\Validator\EmailAddress::INVALID_FORMAT]];
}
/**
* Whether this rule supports certain validators
*
* @param ValidatorInterface $validator
* @return mixed
*/
public function canHandle(ValidatorInterface $validator)
{
return $validator instanceof EmailAddressValidator;
}
}