Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
23.53% |
4 / 17 |
|
30.77% |
4 / 13 |
CRAP | |
0.00% |
0 / 1 |
| base | |
23.53% |
4 / 17 |
|
30.77% |
4 / 13 |
88.57 | |
0.00% |
0 / 1 |
| set_notification_manager | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| is_enabled_by_default | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get_notified_users | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| load_notifications | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| add_to_queue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| update_notification | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| mark_notifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| mark_notifications_by_parent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| mark_notifications_by_id | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| delete_notifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| prune_notifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| purge_notifications | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| empty_queue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | |
| 14 | namespace phpbb\notification\method; |
| 15 | |
| 16 | /** |
| 17 | * Base notifications method class |
| 18 | */ |
| 19 | abstract class base implements \phpbb\notification\method\method_interface |
| 20 | { |
| 21 | /** @var \phpbb\notification\manager */ |
| 22 | protected $notification_manager; |
| 23 | |
| 24 | /** |
| 25 | * Queue of messages to be sent |
| 26 | * |
| 27 | * @var array |
| 28 | */ |
| 29 | protected $queue = array(); |
| 30 | |
| 31 | /** |
| 32 | * Set notification manager (required) |
| 33 | * |
| 34 | * @param \phpbb\notification\manager $notification_manager |
| 35 | */ |
| 36 | public function set_notification_manager(\phpbb\notification\manager $notification_manager) |
| 37 | { |
| 38 | $this->notification_manager = $notification_manager; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Is the method enable by default? |
| 43 | * |
| 44 | * @return bool |
| 45 | */ |
| 46 | public function is_enabled_by_default() |
| 47 | { |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * {@inheritdoc} |
| 53 | */ |
| 54 | public function get_notified_users($notification_type_id, array $options) |
| 55 | { |
| 56 | return array(); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * {@inheritdoc} |
| 61 | */ |
| 62 | public function load_notifications(array $options = array()) |
| 63 | { |
| 64 | return array( |
| 65 | 'notifications' => array(), |
| 66 | 'unread_count' => 0, |
| 67 | 'total_count' => 0, |
| 68 | ); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Add a notification to the queue |
| 73 | * |
| 74 | * @param \phpbb\notification\type\type_interface $notification |
| 75 | */ |
| 76 | public function add_to_queue(\phpbb\notification\type\type_interface $notification) |
| 77 | { |
| 78 | $this->queue[] = $notification; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * {@inheritdoc} |
| 83 | */ |
| 84 | public function update_notification($notification, array $data, array $options) |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * {@inheritdoc |
| 90 | */ |
| 91 | public function mark_notifications($notification_type_id, $item_id, $user_id, $time = false, $mark_read = true) |
| 92 | { |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * {@inheritdoc} |
| 97 | */ |
| 98 | public function mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time = false, $mark_read = true) |
| 99 | { |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * {@inheritdoc} |
| 104 | */ |
| 105 | public function mark_notifications_by_id($notification_id, $time = false, $mark_read = true) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * {@inheritdoc} |
| 111 | */ |
| 112 | public function delete_notifications($notification_type_id, $item_id, $parent_id = false, $user_id = false) |
| 113 | { |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * {@inheritdoc} |
| 118 | */ |
| 119 | public function prune_notifications($timestamp, $only_read = true) |
| 120 | { |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * {@inheritdoc} |
| 125 | */ |
| 126 | public function purge_notifications($notification_type_id) |
| 127 | { |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Empty the queue |
| 132 | */ |
| 133 | protected function empty_queue() |
| 134 | { |
| 135 | $this->queue = array(); |
| 136 | } |
| 137 | } |