Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
68.75% covered (warning)
68.75%
11 / 16
54.55% covered (warning)
54.55%
6 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
group_request_approved
68.75% covered (warning)
68.75%
11 / 16
54.55% covered (warning)
54.55%
6 / 11
18.16
0.00% covered (danger)
0.00%
0 / 1
 get_type
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 is_available
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_item_id
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_item_parent_id
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 find_users_for_notification
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
3
 get_title
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_url
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 create_insert_array
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 users_to_query
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_email_template
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_email_template_variables
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14namespace phpbb\notification\type;
15
16class group_request_approved extends \phpbb\notification\type\base
17{
18    /**
19    * {@inheritdoc}
20    */
21    public function get_type()
22    {
23        return 'notification.type.group_request_approved';
24    }
25
26    /**
27    * {@inheritdoc}
28    */
29    public function is_available()
30    {
31        return false;
32    }
33
34    /**
35    * {@inheritdoc}
36    */
37    public static function get_item_id($type_data)
38    {
39        return (int) $type_data['group_id'];
40    }
41
42    /**
43    * {@inheritdoc}
44    */
45    public static function get_item_parent_id($type_data)
46    {
47        return 0;
48    }
49
50    /**
51    * {@inheritdoc}
52    */
53    public function find_users_for_notification($type_data, $options = array())
54    {
55        $users = array();
56
57        $type_data['user_ids'] = (!is_array($type_data['user_ids'])) ? array($type_data['user_ids']) : $type_data['user_ids'];
58
59        foreach ($type_data['user_ids'] as $user_id)
60        {
61            $users[$user_id] = $this->notification_manager->get_default_methods();
62        }
63
64        return $users;
65    }
66
67    /**
68    * {@inheritdoc}
69    */
70    public function get_title()
71    {
72        return $this->language->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name'));
73    }
74
75    /**
76    * {@inheritdoc}
77    */
78    public function get_url()
79    {
80        return append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, "mode=group&g={$this->item_id}");
81    }
82
83    /**
84    * {@inheritdoc}
85    */
86    public function create_insert_array($type_data, $pre_create_data = array())
87    {
88        $this->set_data('group_name', $type_data['group_name']);
89
90        parent::create_insert_array($type_data, $pre_create_data);
91    }
92
93    /**
94    * {@inheritdoc}
95    */
96    public function users_to_query()
97    {
98        return array();
99    }
100
101    /**
102    * {@inheritdoc}
103    */
104    public function get_email_template()
105    {
106        return false;
107    }
108
109    /**
110    * {@inheritdoc}
111    */
112    public function get_email_template_variables()
113    {
114        return array();
115    }
116}