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

HtmlFormInput   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 0
cbo 4
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 3
A getDataField() 0 6 2
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
}