Completed
Push — master ( 3555a5...e61355 )
by Jean-Christophe
03:33
created

Widget   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 42
rs 10
c 1
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A show() 0 3 1
A getModel() 0 3 1
A setModel() 0 4 1
A getInstanceViewer() 0 3 1
A setInstanceViewer() 0 4 1
getHtmlComponent() 0 1 ?
A setColor() 0 3 1
1
<?php
2
3
namespace Ajax\common;
4
5
use Ajax\common\html\HtmlDoubleElement;
6
7
abstract class Widget extends HtmlDoubleElement {
8
9
	protected $_model;
10
	protected $_modelInstance;
11
	protected $_instanceViewer;
12
13
	public function __construct($identifier,$model,$modelInstance=NULL) {
14
		parent::__construct($identifier);
15
		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
16
		$this->setModel($model);
17
		if(isset($modelInstance));
18
			$this->show($modelInstance);
19
	}
20
21
	public function show($modelInstance){
22
		$this->_modelInstance=$modelInstance;
23
	}
24
25
	public function getModel() {
26
		return $this->_model;
27
	}
28
29
	public function setModel($_model) {
30
		$this->_model=$_model;
31
		return $this;
32
	}
33
34
	public function getInstanceViewer() {
35
		return $this->_instanceViewer;
36
	}
37
38
	public function setInstanceViewer($_instanceViewer) {
39
		$this->_instanceViewer=$_instanceViewer;
40
		return $this;
41
	}
42
43
	public abstract function getHtmlComponent();
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
44
45
	public function setColor($color){
46
		return $this->getHtmlComponent()->setColor($color);
47
	}
48
}