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

tiles::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 11
crap 2

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 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\views\driver;
11
12
class tiles extends base_view
13
{
14
	/** @var \phpbb\request\request_interface */
15
	protected $request;
16
17
	/**
18
	 * Constructor
19
	 *
20
	 * @param \phpbb\event\dispatcher_interface			$phpbb_dispatcher	Event dispatcher object
21
	 * @param \phpbb\language\language					$language			Language Object
22
	 * @param \phpbb\pagination							$pagination			Pagination object
23
	 * @param \phpbb\template\template					$template			Template object
24
	 * @param \blitze\content\services\fields			$fields				Content fields object
25
	 * @param \blitze\sitemaker\services\forum\data		$forum				Forum Data object
26
	 * @param \blitze\content\services\helper			$helper				Content helper object
27
	 * @param \blitze\content\services\quickmod			$quickmod			Quick moderator tools
28
	 * @param string									$phpbb_root_path	Path to the phpbb includes directory.
29
	 * @param string									$php_ext			php file extension
30
	 * @param \phpbb\request\request_interface			$request			Request object
31
	*/
32
	public function __construct(\phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\language\language $language, \phpbb\pagination $pagination, \phpbb\template\template $template, \blitze\content\services\fields $fields, \blitze\sitemaker\services\forum\data $forum, \blitze\content\services\helper $helper, \blitze\content\services\quickmod $quickmod, $phpbb_root_path, $php_ext, \phpbb\request\request_interface $request)
33
	{
34
		parent::__construct($phpbb_dispatcher, $language, $pagination, $template, $fields, $forum, $helper, $quickmod, $phpbb_root_path, $php_ext);
35
36
		$this->request = $request;
37
	}
38
39
	/**
40
	 * @inheritdoc
41
	 */
42
	public function get_name()
43
	{
44
		return 'tiles';
45
	}
46
47
	/**
48
	 * @inheritdoc
49
	 */
50
	public function get_langname()
51
	{
52
		return 'CONTENT_DISPLAY_TILES';
53
	}
54
55
	/**
56
	 * @inheritdoc
57
	 */
58
	public function get_index_template()
59
	{
60
		return 'views/tiles.html';
61
	}
62
63
	/**
64
	 * @inheritdoc
65
	 */
66
	public function render_index(\blitze\content\model\entity\type $entity, $page, $filter_type, $filter_value)
67
	{
68
		parent::render_index($entity, $page, $filter_type, $filter_value);
69
70
		if ($this->request->is_ajax())
71
		{
72
			$this->template->assign_var('S_HIDE_HEADERS', true);
73
		}
74
	}
75
}
76