Passed
Push — master ( 158267...cd0d6c )
by Michael
02:28
created

weblinks.php ➔ b_waiting_weblinks()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 41

Duplication

Lines 41
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
nc 8
nop 0
dl 41
loc 41
rs 9.264
c 0
b 0
f 0
1
<?php
2
/**
3
 * @return array
4
 */
5
function b_waiting_weblinks()
6
{
7
        /** @var \XoopsMySQLDatabase $xoopsDB */
8
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
9
    $ret     = [];
10
11
    // weblinks links
12
    $block  = [];
13
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('weblinks_modify') . ' WHERE mode=0');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...fy') . ' WHERE mode=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...
14
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
15
        //      $block['adminlink'] = XOOPS_URL."/modules/weblinks/admin/index.php?op=listNewLinks";
16
        $block['adminlink'] = XOOPS_URL . '/modules/weblinks/admin/link_manage.php?op=listNewLinks';
17
18
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
19
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
20
    }
21
    $ret[] = $block;
22
23
    // weblinks broken
24
    $block  = [];
25
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('weblinks_broken'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...fix('weblinks_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...
26
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
27
        $block['adminlink'] = XOOPS_URL . '/modules/weblinks/admin/index.php?op=listBrokenLinks';
28
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
29
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
30
    }
31
    $ret[] = $block;
32
33
    // weblinks modreq
34
    $block  = [];
35
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('weblinks_modify') . ' WHERE mode=1');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...fy') . ' WHERE mode=1') 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...
36
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
37
        //      $block['adminlink'] = XOOPS_URL."/modules/weblinks/admin/index.php?op=listModReq";
38
        $block['adminlink'] = XOOPS_URL . '/modules/weblinks/admin/link_manage.php?op=listModReq';
39
40
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
41
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
42
    }
43
    $ret[] = $block;
44
45
    return $ret;
46
}
47