Completed
Push — master ( b49918...3cf661 )
by Jean-Christophe
03:33
created

HtmlInput   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 6
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 26
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A setValue() 0 5 2
A setInputType() 0 3 1
A setPlaceholder() 0 5 2
1
<?php
2
3
namespace Ajax\common\html\html5;
4
5
use Ajax\common\html\HtmlSingleElement;
6
use Ajax\service\JString;
7
8
class HtmlInput extends HtmlSingleElement {
9
10
	public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) {
11
		parent::__construct($identifier, "input");
12
		$this->setProperty("name", $identifier);
13
		$this->setValue($value);
14
		$this->setPlaceholder($placeholder);
15
		$this->setProperty("type", $type);
16
	}
17
18
	public function setValue($value) {
19
		if(isset($value))
20
		$this->setProperty("value", $value);
21
		return $this;
22
	}
23
24
	public function setInputType($value) {
25
		return $this->setProperty("type", $value);
26
	}
27
28
	public function setPlaceholder($value){
29
		if(JString::isNotNull($value))
30
			$this->setProperty("placeholder", $value);
31
		return $this;
32
	}
33
}