Completed
Push — master ( cd0fd2...97e05d )
by Jean-Christophe
03:14
created

HtmlLabeledIconMenu   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createItem() 0 13 2
1
<?php
2
3
namespace Ajax\semantic\html\collections;
4
5
use Ajax\semantic\html\collections\HtmlMenu;
6
use Ajax\bootstrap\html\HtmlLink;
7
use Ajax\semantic\html\elements\HtmlIcon;
8
9
/**
10
 * Semantic Menu component with only labeled icons
11
 * @see http://semantic-ui.com/collections/menu.html
12
 * @author jc
13
 * @version 1.001
14
 */
15
class HtmlLabeledIconMenu extends HtmlMenu{
16
17
18
	/**
19
	 * @param string $identifier
20
	 * @param array $items icons
21
	 */
22
	public function __construct( $identifier, $items=array()){
23
		parent::__construct( $identifier, $items);
24
		$this->addToProperty("class", "labeled icon");
25
	}
26
27
	/**
28
	 * {@inheritDoc}
29
	 * @see \Ajax\semantic\html\collections\HtmlMenu::createItem()
30
	 */
31
	protected function createItem($value) {
32
		$text="";
33
		$v=$value;
34
		if(\is_array($value)){
35
			$v=@$value[0];
36
			$text=@$value[1];
37
		}
38
		$count=\sizeof($this->content);
39
		$value=new HtmlIcon("icon-".$count, $v);
40
		$value->wrap("",$text);
41
		$itemO=new HtmlLink("item-".$count,"",$value);
42
		return $itemO->setClass("item");
43
	}
44
}