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

HtmlFormDropdown   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setItems() 0 3 1
A addItem() 0 3 1
A multipleDropdown() 0 3 1
1
<?php
2
3
namespace Ajax\semantic\html\collections\form;
4
5
use Ajax\semantic\html\collections\form\HtmlFormField;
6
use Ajax\semantic\html\modules\HtmlDropdown;
7
8
class HtmlFormDropdown extends HtmlFormField {
9
10
	public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false) {
11
		parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items))->asSelect($identifier,$multiple), $label);
12
	}
13
14
	public function setItems($items){
15
		return $this->getField()->setItems($items);
16
	}
17
	public function addItem($item,$value=NULL,$image=NULL){
18
		return $this->getField()->addItem($item,$value,$image);
19
	}
20
	public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL){
21
		return new HtmlFormDropdown($identifier,$items,$label,$value,true);
22
	}
23
}