Completed
Push — master ( 587f5e...7e0186 )
by Jean-Christophe
04:40
created

EmailValidator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Ubiquity\contents\validation\validators\strings;
4
5
/**
6
 * Validates an email address
7
 * Usage @validator("email")
8
 * @author jc
9
 * @version 1.0.0
10
 */
11
class EmailValidator extends RegexValidator {
12
	
13 1
	public function __construct(){
14 1
		$this->message="{value} is not a valid email address";
15 1
		$this->ref="/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i";
16 1
		$this->match=true;
17 1
	}
18
}
19
20