Completed
Push — master ( dc8f37...8770f3 )
by Henry
15:26 queued 05:23
created

Text::sanitize()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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