Completed
Push — master ( 349ff5...40080a )
by Jean-Christophe
03:11
created

Widget::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
namespace Ajax\common;
4
5
use Ajax\common\html\HtmlDoubleElement;
6
7
class Widget extends HtmlDoubleElement {
8
9
	protected $_modelInstance;
10
11
	public function __construct($identifier,$modelInstance=NULL) {
12
		parent::__construct($identifier);
13
		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
14
		if(isset($modelInstance));
15
			$this->show($modelInstance);
16
	}
17
18
	public function show($modelInstance){
19
		$this->_modelInstance=$modelInstance;
20
	}
21
22
	public function getInstanceClassName(){
23
		if(\is_array($this->_modelInstance)){
24
			if(\sizeof($this->_modelInstance)>0){
25
				return \get_class($this->_modelInstance[0]);
26
			}
27
		}else{
28
			return \get_class($this->_modelInstance);
29
		}
30
		return false;
31
	}
32
}