Completed
Push — master ( 9de830...b49918 )
by Jean-Christophe
03:44
created

HtmlForm   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createItem() 0 7 2
1
<?php
2
3
namespace Ajax\semantic\html\collections\form;
4
5
use Ajax\semantic\html\base\HtmlSemCollection;
6
use Ajax\service\JArray;
7
8
class HtmlForm extends HtmlSemCollection{
9
10
11
	public function __construct( $identifier, $elements=array()){
12
		parent::__construct( $identifier, "form", "ui form");
13
		$this->setProperty("name", $this->identifier);
14
		$this->addItems($elements);
15
	}
16
17
18
	protected function createItem($value){
19
		if(\is_array($value)){
20
			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null)));
21
			return $itemO;
22
		}else
23
		return new HtmlFormInput($value);
24
	}
25
26
}