Completed
Push — master ( 409900...f20dfb )
by Jean-Christophe
03:24
created

InternalPopup   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setHtml() 0 4 1
A setAttributes() 0 4 1
A onShow() 0 3 1
B compile() 0 14 5
A run() 0 3 1
1
<?php
2
3
namespace Ajax\semantic\html\content;
4
5
use Ajax\JsUtils;
6
use Ajax\service\JString;
7
class InternalPopup {
8
	protected $title;
9
	protected $content;
10
	protected $html;
11
	protected $variation;
12
	protected $params;
13
	protected $semElement;
14
	public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){
15
		$this->semElement=$semElement;
16
		$this->title=$title;
17
		$this->content=$content;
18
		$this->setAttributes($variation,$params);
19
	}
20
21
	public function setHtml($html) {
22
		$this->html=$html;
23
		return $this;
24
	}
25
26
	public function setAttributes($variation=NULL,$params=array()){
27
		$this->variation=$variation;
28
		$this->params=$params;
29
	}
30
31
	public function onShow($jsCode){
32
		$this->params["onShow"]=$jsCode;
33
	}
34
35
	public function compile(){
36
		if(JString::isNotNull($this->title)){
37
			$this->semElement->addToProperty("data-title", $this->title);
38
		}
39
		if(JString::isNotNull($this->content)){
40
			$this->semElement->addToProperty("data-content", $this->content);
41
		}
42
		if(JString::isNotNull($this->html)){
43
			$this->semElement->addToProperty("data-html", $this->html);
44
		}
45
		if(JString::isNotNull($this->variation)){
46
			$this->semElement->addToProperty("data-variation", $this->variation);
47
		}
48
	}
49
50
	public function run(JsUtils $js){
51
		$js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params);
52
	}
53
54
}