Passed
Branch master (cd0d6c)
by Michael
01:35
created

xyp4all.php ➔ b_waiting_xyp4all()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 37
Code Lines 25

Duplication

Lines 37
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
eloc 25
nc 8
nop 0
dl 37
loc 37
rs 8.5806
c 0
b 0
f 0
1
<?php
2
/*************************************************************************/
3
# Waiting Contents Extensible                                            #
4
# Plugin for module PDdownloads                                          #
5
#                                                                        #
6
# Author                                                                 #
7
# flying.tux     -   [email protected]                                #
8
#                                                                        #
9
# Last modified on 21.04.2005                                            #
10
/*************************************************************************/
11
/**
12
 * @return array
13
 */
14
function b_waiting_xyp4all()
15
{
16
        /** @var \XoopsMySQLDatabase $xoopsDB */
17
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
18
    $ret     = [];
19
20
    // xyp4all links
21
    $block  = [];
22
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xyp_links') . ' WHERE status=0');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...') . ' WHERE status=0') targeting XoopsMySQLDatabase::query() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
23
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
24
        $block['adminlink'] = XOOPS_URL . '/modules/xyp4all/admin/index.php?op=listNewLinks';
25
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
26
        $block['lang_linkname'] = _PI_WAITING_LINKS;
27
    }
28
    $ret[] = $block;
29
30
    // xyp4all broken
31
    $block  = [];
32
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xyp_broken'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...->prefix('xyp_broken')) targeting XoopsMySQLDatabase::query() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
33
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
34
        $block['adminlink'] = XOOPS_URL . '/modules/xyp4all/admin/index.php?op=listBrokenLinks';
35
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
36
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
37
    }
38
    $ret[] = $block;
39
40
    // xyp4all modreq
41
    $block  = [];
42
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xyp_mod'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...sDB->prefix('xyp_mod')) targeting XoopsMySQLDatabase::query() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
43
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
44
        $block['adminlink'] = XOOPS_URL . '/modules/xyp4all/admin/index.php?op=listModReq';
45
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
46
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
47
    }
48
    $ret[] = $block;
49
50
    return $ret;
51
}
52