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