Completed
Push — master ( 2affe6...aa2804 )
by Jean-Christophe
03:17
created

HtmlList::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Ajax\semantic\html\elements;
4
5
use Ajax\semantic\html\base\HtmlSemCollection;
6
use Ajax\semantic\html\content\HtmlListItem;
7
8
class HtmlList extends HtmlSemCollection{
9
10
11
	public function __construct( $identifier, $items=array()){
12
		parent::__construct( $identifier, "div", "ui list");
13
		$this->addItems($items);
14
	}
15
16
17
	protected function createItem($value){
18
		$count=$this->count();
19
		if(\is_array($value)){
20
			$item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]);
21
			$item->addIcon($value[1]);
22
		}else
23
			$item= new HtmlListItem("item-".$this->identifier."-".$count, $value);
24
		return $item;
25
	}
26
27
}