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

topic_in_queue::__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 8
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) 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\notification;
11
12
class topic_in_queue extends \phpbb\notification\type\topic_in_queue
13
{
14
	/* @var \blitze\content\services\types */
15
	protected $types;
16
17
	/**
18
	 * Notification Type Base Constructor
19
	 *
20
	 * @param \phpbb\db\driver\driver_interface $db
21
	 * @param \phpbb\language\language          $language
22
	 * @param \phpbb\user                       $user
23
	 * @param \phpbb\auth\auth                  $auth
24
	 * @param string                            $phpbb_root_path
25
	 * @param string                            $php_ext
26
	 * @param string                            $user_notifications_table
27
	 * @param \blitze\content\services\types	$types
28
	 */
29
	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table, \blitze\content\services\types $types)
30
	{
31
		parent::__construct($db, $language, $user, $auth, $phpbb_root_path, $php_ext, $user_notifications_table);
32
33
		$this->types = $types;
34
	}
35
36
	/**
37
	* Get the url to this item
38
	*
39
	* @return string URL
40
	*/
41
	public function get_url()
42
	{
43
		if ($type = $this->types->get_forum_type($this->item_parent_id))
44
		{
45
			return append_sid($this->phpbb_root_path . 'mcp.' . $this->php_ext, "i=-blitze-content-mcp-content_module&amp;mode=content&amp;type=$type&amp;t={$this->item_id}&amp;do=view");
46
		}
47
48
		return parent::get_url();
49
	}
50
}
51