Passed
Push — master ( 39f3dd...5f0b05 )
by Jean-Christophe
07:53
created

SimpleExtComponent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 12
c 2
b 0
f 1
dl 0
loc 25
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addEvent() 0 3 1
A compileJsCodes() 0 4 2
A addCode() 0 2 1
A getScript() 0 4 1
1
<?php
2
3
namespace Ajax\common\components;
4
5
use Ajax\common\JsCode;
6
7
class SimpleExtComponent extends SimpleComponent {
8
	protected $events=array ();
9
	protected $jsCodes=array ();
10
11
	public function addEvent($event, $jsCode) {
12
		$this->events [$event]=$jsCode;
13
		return $this;
14
	}
15
16
	public function getScript() {
17
		parent::getScript();
18
		$this->compileJsCodes();
19
		return $this->compileJQueryCode();
20
	}
21
	
22
	protected function compileJsCodes(){
23
		foreach ( $this->jsCodes as $jsCode ) {
24
			$this->jquery_code_for_compile []=$jsCode->compile(array (
25
				"identifier" => $this->attachTo
26
			));
27
		}
28
	}
29
30
	public function addCode($jsCode) {
31
		$this->jsCodes []=new JsCode($jsCode);
32
	}
33
34
}
35