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

Widget   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A show() 0 3 1
A getInstanceClassName() 0 10 3
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
}