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

Toggle   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 17
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
/**
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