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

HtmlList::setOrdered()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 2
eloc 2
nc 2
nop 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
}