Passed
Branch v1.4.0 (ac3196)
by Wanderson
01:13
created

Checkbox::html()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Win\Html\Form;
4
5
/**
6
 * Checkbox
7
 * <input type="checkbox">
8
 */
9
class Checkbox extends Input
10
{
11
	/**
12
	 * Retorna 'checked' se os valores são iguais
13
	 * @param mixed $value1
14
	 * @param mixed $value2
15
	 * @return string
16
	 */
17
	public static function check($value1, $value2 = true)
18
	{
19
		return ($value1 == $value2) ? 'checked ' : '';
20
	}
21
22
	/**
23
	 * @param string $name
24
	 * @param mixed $value
25
	 * @param string[] $attributes
26
	 */
27
	public function __construct($name, $value = '', $attributes = [])
28
	{
29
		parent::__construct('checkbox', $name, $value, $attributes);
30
	}
31
32
	/** @return string */
33
	public function html()
34
	{
35
		return '<input type="checkbox" />';
36
	}
37
}
38