Completed
Push — master ( 9391c4...3be88f )
by Peter
04:35
created

AbstractWidget   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getView() 0 8 2
A render() 0 4 1
1
<?php
2
3
namespace Maslosoft\Zamm\Widgets;
4
5
use Maslosoft\MiniView\MiniView;
6
7
/**
8
 * AbstractWidget
9
 *
10
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
11
 */
12
abstract class AbstractWidget
13
{
14
15
	/**
16
	 * Mini view instance
17
	 * @var MiniView
18
	 */
19
	private $view = null;
20
21
	/**
22
	 *
23
	 * @return MiniView
24
	 */
25
	public function getView()
26
	{
27
		if (empty($this->view))
28
		{
29
			$this->view = new MiniView($this);
30
		}
31
		return $this->view;
32
	}
33
34
	/**
35
	 * 
36
	 * @param string $view
37
	 * @param mixed $data
38
	 * @return string
39
	 */
40
	public function render($view, $data = [])
41
	{
42
		return $this->getView()->render($view, $data, true);
43
	}
44
45
}
46