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

SimpleExtComponent::getScript()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace Ajax\common\components;
4
5
use Ajax\common\components\SimpleComponent;
6
use Ajax\common\JsCode;
7
8
class SimpleExtComponent extends SimpleComponent {
9
	protected $events=array ();
10
	protected $jsCodes=array ();
11
12
	public function addEvent($event, $jsCode) {
13
		$this->events [$event]=$jsCode;
14
	}
15
16
	public function getScript() {
17
		parent::getScript();
18
		foreach ( $this->jsCodes as $jsCode ) {
19
			$this->jquery_code_for_compile []=$jsCode->compile(array (
20
					"identifier" => $this->attachTo
21
			));
22
		}
23
		return $this->compileJQueryCode();
24
	}
25
26
	public function addCode($jsCode) {
27
		$this->jsCodes []=new JsCode($jsCode);
28
	}
29
}