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

Widget::getInstanceClassName()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 0
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
}