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

poll::display()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 10
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 6
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