Email::sanitize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
namespace Redaxscript\Filter;
3
4
use function filter_var;
5
use function strtolower;
6
7
/**
8
 * children class to filter the email
9
 *
10
 * @since 2.2.0
11
 *
12
 * @package Redaxscript
13
 * @category Filter
14
 * @author Henry Ruhs
15
 */
16
17
class Email implements FilterInterface
18
{
19
	/**
20
	 * sanitize the email
21
	 *
22
	 * @since 2.2.0
23
	 *
24
	 * @param string $email email to be sanitized
25
	 *
26
	 * @return string|null
27
	 */
28
29 5
	public function sanitize(string $email = null) : ?string
30
	{
31 5
		return filter_var(strtolower($email), FILTER_SANITIZE_EMAIL) ? : null;
32
	}
33
}
34