Email   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 27
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 4 1
1
<?php
2
/**
3
 * @package   Fuel\Validation
4
 * @version   2.0
5
 * @author    Fuel Development Team
6
 * @license   MIT License
7
 * @copyright 2010 - 2013 Fuel Development Team
8
 * @link      http://fuelphp.com
9
 */
10
11
namespace Fuel\Validation\Rule;
12
13
use Fuel\Validation\AbstractRule;
14
15
/**
16
 * Checks that the value is a valid email address
17
 *
18
 * @package Fuel\Validation\Rule
19
 * @author  Fuel Development Team
20
 *
21
 * @since 2.0
22
 */
23
class Email extends AbstractRule
24
{
25
26
	/**
27
	 * Contains the rule failure message
28
	 *
29
	 * @var string
30
	 */
31
	protected $message = 'The field does not contain a valid email address.';
32
33
	/**
34
	 * @param mixed $value Value to be validated
35
	 * @param null  $field Unused by this rule
36
	 * @param null  $allFields
37
	 *
38
	 * @internal param null $allFields Unused by this rule
39
	 *
40
	 * @return bool
41
	 *
42
	 * @since 2.0
43
	 */
44 11
	public function validate($value, $field = null, $allFields = null)
45
	{
46 11
		return false !== filter_var($value, FILTER_VALIDATE_EMAIL);
47
	}
48
49
}
50