Completed
Push — master ( b23d1e...03b6f4 )
by Jean-Christophe
04:33
created

SimpleSemExtComponent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generateParamParts() 0 7 2
A getScript() 0 11 2
A setParamParts() 0 4 1
1
<?php
2
3
namespace Ajax\semantic\components;
4
5
use Ajax\common\components\SimpleExtComponent;
6
use Ajax\JsUtils;
7
8
class SimpleSemExtComponent extends SimpleExtComponent {
9
	protected $paramParts;
10
	public function __construct(JsUtils $js) {
11
		parent::__construct($js);
12
		$this->paramParts=array();
13
	}
14
15
	protected function generateParamParts(){
16
		$results=[];
17
		foreach ($this->paramParts as $paramPart){
18
			$results[]="{$this->uiName}(".\implode(",", $paramPart).")";
19
		}
20
		return \implode(".", $results);
21
	}
22
23
	public function getScript() {
24
		$allParams=$this->params;
25
		$this->jquery_code_for_compile=array ();
26
		$paramParts="";
27
		if(\sizeof($this->paramParts)>0){
28
			$paramParts=".".$this->generateParamParts();
29
		}
30
		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).")".$paramParts.";";
31
		$this->compileEvents();
32
		return $this->compileJQueryCode();
33
	}
34
35
	public function setParamParts($paramParts) {
36
		$this->paramParts=$paramParts;
37
		return $this;
38
	}
39
40
}