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

HtmlOption   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 25
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A select() 0 4 1
A getValue() 0 3 1
A setValue() 0 4 1
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