Completed
Push — master ( 848ec5...d8452d )
by Jean-Christophe
02:59
created

HtmlFormInput::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 5
1
<?php
2
3
namespace Ajax\semantic\html\collections\form;
4
5
use Ajax\semantic\html\collections\form\traits\TextFieldsTrait;
6
use Ajax\semantic\html\collections\form\traits\FieldTrait;
7
use Ajax\semantic\html\elements\HtmlInput;
8
9
class HtmlFormInput extends HtmlFormField {
10
	use TextFieldsTrait,FieldTrait;
11
12
	public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) {
13
		if(!isset($placeholder) && $type==="text")
14
			$placeholder=$label;
15
		parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label);
16
	}
17
18
	public function getDataField(){
19
		$field= $this->getField();
20
		if($field instanceof HtmlInput)
21
			$field=$field->getField();
22
		return $field;
23
	}
24
}