Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public static function filter($value) |
||
25 | { |
||
26 | if (!is_string($value)) { |
||
27 | throw new \Exception("Value '" . var_export($value, true) . "' is not a string"); |
||
28 | } |
||
29 | |||
30 | $filteredEmail = filter_var($value, FILTER_VALIDATE_EMAIL); |
||
31 | if ($filteredEmail === false) { |
||
32 | throw new \Exception("Value '{$value}' is not a valid email"); |
||
33 | } |
||
34 | |||
35 | return $filteredEmail; |
||
36 | } |
||
37 | } |
||
38 |