Completed
Push — master ( fdc0c0...9de830 )
by Jean-Christophe
03:31
created

HtmlAccordionItem   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setTitle() 0 3 1
A setIcon() 0 3 1
A createTitleElement() 0 5 1
A compile() 0 4 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\JsUtils;
8
use Phalcon\Mvc\View;
9
10
11
class HtmlAccordionItem extends HtmlSemDoubleElement {
12
	protected $titleElement;
13
	protected $_icon="dropdown";
14
	protected $_title;
15
16
	public function __construct($identifier, $title, $content=NULL) {
17
		parent::__construct($identifier, "div", "content", $content);
18
		$this->_template="%titleElement%".$this->_template;
19
		$this->_title=$title;
20
	}
21
22
	public function setTitle($title){
23
		$this->_title=$title;
24
	}
25
26
	public function setIcon($icon){
27
		$this->_icon=$icon;
28
	}
29
30
	protected function createTitleElement(){
31
		$element=new HtmlSemDoubleElement("title-".$this->identifier,"div","title");
32
		$element->setContent(array(new HtmlIcon("", $this->_icon),$this->_title));
33
		return $element;
34
	}
35
36
	public function compile(JsUtils $js=NULL, View $view=NULL){
37
		$this->titleElement=$this->createTitleElement();
38
		return parent::compile($js,$view);
39
	}
40
}