Completed
Push — master ( b4ccca...781bd5 )
by Jean-Christophe
03:50
created

HtmlCardHeaderContent   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 15 5
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
		if (\is_array($metas)) {
18
			foreach ( $metas as $meta ) {
19
				$this->addMeta($meta);
20
			}
21
		} else
22
			$this->addMeta($metas);
23
		if (isset($description)) {
24
			$this->setDescription($description);
25
		}
26
	}
27
28
	public function setDescription($value) {
29
		$this->content["description"]=new HtmlSemDoubleElement("description-" . $this->identifier, "div", "description", $value);
30
	}
31
32
	public function setHeader($value) {
33
		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
34
	}
35
36
	/**
37
	 *
38
	 * {@inheritDoc}
39
	 *
40
	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
41
	 */
42
	public function compile(JsUtils $js=NULL, View $view=NULL) {
43
		$this->content=JArray::sortAssociative($this->content, [ "header","meta","description" ]);
44
		return parent::compile($js, $view);
45
	}
46
}