Completed
Push — master ( fcfed5...b7a7dd )
by Jean-Christophe
03:28
created

HtmlViewHeaderContent::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Ajax\semantic\html\content\view;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\JsUtils;
7
8
use Ajax\service\JArray;
9
10
class HtmlViewHeaderContent extends HtmlViewContent {
11
12
	public function __construct($identifier, $header=NULL, $metas=array(), $description=NULL,$extra=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
		if (isset($extra)) {
22
			$this->setExtra($extra);
23
		}
24
	}
25
26
	public function setDescription($value) {
27
		$this->content["description"]=new HtmlSemDoubleElement("description-" . $this->identifier, "div", "description", $value);
28
	}
29
30
	public function setHeader($value) {
31
		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
32
	}
33
34
	public function setExtra($value) {
35
		$this->content["extra"]=new HtmlSemDoubleElement("extra-" . $this->identifier, "a", "extra", $value);
36
	}
37
38
	/**
39
	 *
40
	 * {@inheritDoc}
41
	 *
42
	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
43
	 */
44
	public function compile(JsUtils $js=NULL, &$view=NULL) {
45
		$this->content=JArray::sortAssociative($this->content, [ "image","header","meta","description","extra" ]);
46
		return parent::compile($js, $view);
47
	}
48
}