Passed
Pull Request — master (#18)
by Michael
02:50
created

XoopspollUserlogPlugin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A item() 0 12 3
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
/**
12
 *  userlog module
13
 *
14
 * @copyright       XOOPS Project (http://xoops.org)
15
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
16
 * @package         newbb class plugin
17
 * @since           4.31
18
 * @author          irmtfan ([email protected])
19
 * @author          XOOPS Project <www.xoops.org> <www.xoops.ir>
20
 */
21
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
22
23
class XoopspollUserlogPlugin extends \Userlog_Module_Plugin_Abstract implements \UserlogPluginInterface
0 ignored issues
show
Bug introduced by
The type Userlog_Module_Plugin_Abstract 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...
Bug introduced by
The type UserlogPluginInterface 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...
24
{
25
    /**
26
     * @param string $subscribe_from Name of the script
27
     *
28
     * 'name' => 'thread';
29
     * 'title' => _MI_NEWBB_THREAD_NOTIFY;
30
     * 'description' => _MI_NEWBB_THREAD_NOTIFYDSC;
31
     * 'subscribe_from' => 'viewtopic.php';
32
     * 'item_name' => 'topic_id';
33
     * 'allow_bookmark' => 1;
34
     *
35
     * @return array $item["item_name"] name of the item, $item["item_id"] id of the item
36
     */
37
    public function item($subscribe_from)
38
    {
39
        xoops_load('XoopsRequest');
40
        $poll_id = XoopsRequest::getInt('poll_id', 0);
41
        switch ($subscribe_from) {
42
            case 'index.php':
43
            case 'pollresults.php':
44
                return ['item_name' => 'poll_id', 'item_id' => $poll_id];
45
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
46
        }
47
48
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type array.
Loading history...
49
    }
50
}
51