Completed
Push — develop ( 755a17...843010 )
by Daniel
07:33
created

poll   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 37
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A display() 0 12 2
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2017 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\services;
11
12
class poll
13
{
14
	/** @var \blitze\sitemaker\services\poll */
15
	protected $poll;
16
17
	/** @var \blitze\sitemaker\services\template */
18
	protected $ptemplate;
19
20
	/**
21
	 * Constructor
22
	 *
23
	 * @param \blitze\sitemaker\services\poll		$poll			Poll Object
24
	 * @param \blitze\sitemaker\services\template	$ptemplate		Sitemaker Template Object
25
	*/
26
	public function __construct(\blitze\sitemaker\services\poll $poll, \blitze\sitemaker\services\template $ptemplate)
27
	{
28
		$this->poll = $poll;
29
		$this->ptemplate = $ptemplate;
30
	}
31
32
	/**
33
	 * @param array $topic_data
34
	 * @return string
35
	 */
36
	public function display(array $topic_data)
37
	{
38
		$content = '';
39
		if ($topic_data['poll_start'])
40
		{
41
			$this->poll->build($topic_data, $this->ptemplate);
42
43
			$content = $this->ptemplate->render_view('blitze/sitemaker', 'blocks/forum_poll.html', 'topic_poll');
44
		}
45
46
		return $content;
47
	}
48
}
49