Password   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A sanitize() 0 4 2
1
<?php
2
namespace Redaxscript\Filter;
3
4
use function preg_replace;
5
6
/**
7
 * children class to filter the password
8
 *
9
 * @since 4.3.0
10
 *
11
 * @package Redaxscript
12
 * @category Filter
13
 * @author Henry Ruhs
14
 */
15
16
class Password implements FilterInterface
17
{
18
	/**
19
	 * pattern for password
20
	 *
21
	 * @var string
22
	 */
23
24
	protected $_pattern = '[^\S]';
25
26
	/**
27
	 * sanitize the password
28
	 *
29
	 * @since 4.3.0
30
	 *
31
	 * @param string $password plain password
32
	 *
33
	 * @return string|null
34
	 */
35
36 3
	public function sanitize(string $password = null) : ?string
37
	{
38 3
		return preg_replace('/' . $this->_pattern . '/i', null, $password) ? : null;
39
	}
40
}
41