Completed
Push — master ( b9a8b8...3e8704 )
by Jean-Christophe
03:43
created

HtmlOption::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 6
nc 1
nop 3
1
<?php
2
namespace Ajax\common\html\html5;
3
use Ajax\common\html\HtmlDoubleElement;
4
/**
5
 * HTML Select
6
 * @author jc
7
 * @version 1.002
8
 */
9
10
class HtmlOption extends HtmlDoubleElement {
11
	protected $value;
12
	protected $selected;
13
	public function __construct($identifier,$caption,$value="") {
14
		parent::__construct($identifier, "option");
15
		$this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>';
16
		$this->content=$caption;
17
		$this->value=$value;
18
		$this->selected="";
19
	}
20
21
	public function select(){
22
		$this->selected="selected";
23
		return $this;
24
	}
25
26
	public function getValue() {
27
		return $this->value;
28
	}
29
	public function setValue($value) {
30
		$this->value = $value;
31
		return $this;
32
	}
33
34
}
35