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

HtmlCardHeaderContent::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 3
eloc 7
nc 4
nop 4
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
}