Completed
Push — master ( 19ac8a...195df7 )
by Jean-Christophe
03:23
created

HtmlList   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setOrdered() 0 3 2
A createItem() 0 6 1
1
<?php
2
3
namespace Ajax\common\html\html5;
4
5
use Ajax\common\html\HtmlDoubleElement;
6
/**
7
 * Html list (ul or ol)
8
 * @author jc
9
 * @version 1.001
10
 */
11
class HtmlList extends HtmlCollection {
12
	public function __construct($identifier, $items=array()) {
13
		parent::__construct($identifier, "ul");
14
		$this->addItems($items);
15
	}
16
	public function setOrdered($ordered=true){
17
		$this->tagName=($ordered===true)?"ol":"ul";
18
	}
19
20
	/**
21
	 * {@inheritDoc}
22
	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
23
	 */
24
	protected function createItem($value) {
25
		$item=new HtmlDoubleElement("item-".$this->identifier."-".$this->count());
26
		$item->setTagName("li");
27
		$item->setContent($value);
28
		return $item;
29
	}
30
31
}