Completed
Push — master ( 73e21a...085edf )
by Jean-Christophe
04:37
created

HtmlMenuItem::initContent()   B

Complexity

Conditions 5
Paths 9

Size

Total Lines 21
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 8.7624
cc 5
eloc 16
nc 9
nop 1
1
<?php
2
3
namespace Ajax\semantic\html\content;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\semantic\html\elements\HtmlIcon;
7
use Ajax\service\JArray;
8
9
class HtmlMenuItem extends HtmlAbsractItem {
10
11
	public function __construct($identifier, $content) {
12
		parent::__construct($identifier,"item",$content);
13
	}
14
15
	protected function initContent($content){
16
		if(\is_array($content)){
17
			if(JArray::isAssociative($content)===false){
18
				$icon=@$content[0];
19
				$title=@$content[1];
20
				$desc=@$content[2];
21
			}else{
22
				$icon=@$content["icon"];
23
				$title=@$content["title"];
24
				$desc=@$content["description"];
25
			}
26
			if(isset($icon)===true){
27
				$this->setIcon($icon);
28
			}
29
			if(isset($title)===true){
30
				$this->setTitle($title,$desc);
31
			}
32
		}else{
33
			$this->setContent($content);
34
		}
35
	}
36
/*	public function addIcon($icon, $before=true) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
37
		$content=$this->content;
38
		$this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content");
39
		$this->content->setContent($content);
40
		$this->content->addContent(new HtmlIcon("icon" . $this->identifier, $icon), $before);
41
		return $this;
42
	}*/
43
}