Completed
Push — master ( 96a033...7625bb )
by Henry
07:07
created

Toggle::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
/**
5
 * children class to filter the toggle
6
 *
7
 * @since 4.2.0
8
 *
9
 * @package Redaxscript
10
 * @category Filter
11
 * @author Henry Ruhs
12
 */
13
14
class Toggle implements FilterInterface
15
{
16
	/**
17
	 * sanitize the $toggle
18
	 *
19
	 * @since 4.2.0
20
	 *
21
	 * @param string $toggle
22
	 *
23
	 * @return int
24
	 */
25
26
	public function sanitize(string $toggle = null) : int
27
	{
28
		return $toggle === 'on' ? 1 : 0;
29
	}
30
}
31