poll::display()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
ccs 0
cts 9
cp 0
crap 6
rs 10
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 */
0 ignored issues
show
Bug introduced by
The type blitze\sitemaker\services\poll was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
	protected $poll;
16
17
	/** @var \blitze\sitemaker\services\template */
0 ignored issues
show
Bug introduced by
The type blitze\sitemaker\services\template was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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