group_added   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 17
dl 0
loc 99
rs 10
c 2
b 1
f 0
wmc 13

11 Methods

Rating   Name   Duplication   Size   Complexity  
A is_available() 0 3 1
A get_title() 0 3 1
A get_email_template() 0 3 1
A get_item_id() 0 3 1
A get_item_parent_id() 0 3 1
A find_users_for_notification() 0 12 3
A get_type() 0 3 1
A get_email_template_variables() 0 3 1
A create_insert_array() 0 5 1
A users_to_query() 0 3 1
A get_url() 0 3 1
1
<?php
2
/**
3
*
4
* Auto Groups extension for the phpBB Forum Software package.
5
*
6
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace phpbb\autogroups\notification\type;
12
13
class group_added extends \phpbb\notification\type\base
0 ignored issues
show
Bug introduced by
The type phpbb\notification\type\base 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...
14
{
15
	/**
16
	 * {@inheritdoc}
17
	 */
18
	public function get_type()
19
	{
20
		return 'phpbb.autogroups.notification.type.group_added';
21
	}
22
23
	/**
24
	 * {@inheritdoc}
25
	 */
26
	public function is_available()
27
	{
28
		return false;
29
	}
30
31
	/**
32
	 * {@inheritdoc}
33
	 */
34
	public static function get_item_id($type_data)
35
	{
36
		return (int) $type_data['group_id'];
37
	}
38
39
	/**
40
	 * {@inheritdoc}
41
	 */
42
	public static function get_item_parent_id($type_data)
43
	{
44
		return 0;
45
	}
46
47
	/**
48
	 * {@inheritdoc}
49
	 */
50
	public function find_users_for_notification($type_data, $options = array())
51
	{
52
		$users = array();
53
54
		$type_data['user_ids'] = (!is_array($type_data['user_ids'])) ? array($type_data['user_ids']) : $type_data['user_ids'];
55
56
		foreach ($type_data['user_ids'] as $user_id)
57
		{
58
			$users[$user_id] = $this->notification_manager->get_default_methods();
59
		}
60
61
		return $users;
62
	}
63
64
	/**
65
	 * {@inheritdoc}
66
	 */
67
	public function users_to_query()
68
	{
69
		return array();
70
	}
71
72
	/**
73
	 * {@inheritdoc}
74
	 */
75
	public function get_title()
76
	{
77
		return $this->language->lang('AUTOGROUPS_NOTIFICATION_GROUP_ADDED', $this->get_data('group_name'));
78
	}
79
80
	/**
81
	 * {@inheritdoc}
82
	 */
83
	public function get_url()
84
	{
85
		return append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, "mode=group&amp;g={$this->item_id}");
0 ignored issues
show
Bug introduced by
The function append_sid was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

85
		return /** @scrutinizer ignore-call */ append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, "mode=group&amp;g={$this->item_id}");
Loading history...
86
	}
87
88
	/**
89
	 * {@inheritdoc}
90
	 */
91
	public function get_email_template()
92
	{
93
		return false;
94
	}
95
96
	/**
97
	 * {@inheritdoc}
98
	 */
99
	public function get_email_template_variables()
100
	{
101
		return array();
102
	}
103
104
	/**
105
	 * {@inheritdoc}
106
	 */
107
	public function create_insert_array($type_data, $pre_create_data = array())
108
	{
109
		$this->set_data('group_name', $type_data['group_name']);
110
111
		parent::create_insert_array($type_data, $pre_create_data);
112
	}
113
}
114