Completed
Push — master ( e04e71...98392d )
by Jean-Christophe
03:50
created

HtmlCardHeaderContent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A setDescription() 0 3 1
A setHeader() 0 3 1
A compile() 0 4 1
1
<?php
2
3
namespace Ajax\semantic\html\content\card;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\JsUtils;
7
use Phalcon\Mvc\View;
8
use Ajax\service\JArray;
9
10
class HtmlCardHeaderContent extends HtmlCardContent {
11
12
	public function __construct($identifier, $header=NULL, $metas=array(), $description=NULL) {
13
		parent::__construct($identifier, array ());
14
		if (isset($header)) {
15
			$this->setHeader($header);
16
		}
17
		$this->addMetas($metas);
18
		if (isset($description)) {
19
			$this->setDescription($description);
20
		}
21
	}
22
23
	public function setDescription($value) {
24
		$this->content["description"]=new HtmlSemDoubleElement("description-" . $this->identifier, "div", "description", $value);
25
	}
26
27
	public function setHeader($value) {
28
		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
29
	}
30
31
	/**
32
	 *
33
	 * {@inheritDoc}
34
	 *
35
	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
36
	 */
37
	public function compile(JsUtils $js=NULL, View $view=NULL) {
38
		$this->content=JArray::sortAssociative($this->content, [ "image","header","meta","description" ]);
39
		return parent::compile($js, $view);
40
	}
41
}