Completed
Push — master ( aeb11c...f98da5 )
by Adrian
02:32
created

Email   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 7 1
1
<?php
2
namespace Sirius\Validation\Rule;
3
4
class Email extends AbstractRule
5
{
6
7
    const MESSAGE = 'This input must be a valid email address';
8
9
    const LABELED_MESSAGE = '{label} must be a valid email address';
10
11 13
    public function validate($value, $valueIdentifier = null)
12
    {
13 13
        $this->value   = $value;
14 13
        $this->success = (filter_var((string) $value, FILTER_VALIDATE_EMAIL) !== false);
15
16 13
        return $this->success;
17
    }
18
}
19