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

b_waiting_wfdownloads()   A

Complexity

Conditions 5
Paths 16

Size

Total Lines 47
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 31
nc 16
nop 0
dl 0
loc 47
rs 9.1128
c 0
b 0
f 0
1
<?php
2
/*************************************************************************/
3
# Waiting Contents Extensible                                            #
4
# Plugin for module WF-Downloads                                         #
5
#                                                                        #
6
# Author                                                                 #
7
# coldfire                                                               #
8
#                                                                        #
9
# Modified by                                                            #
10
# flying.tux     -   [email protected]                                #
11
#                                                                        #
12
# Last modified on 21.04.2005                                            #
13
/*************************************************************************/
14
/**
15
 * @return array
16
 */
17
function b_waiting_wfdownloads()
18
{
19
        /** @var \XoopsMySQLDatabase $xoopsDB */
20
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
21
    $ret     = [];
22
23
    // wfdownloads pending
24
    $block  = [];
25
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' 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...
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/wfdownloads/admin/newdownloads.php';
28
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
29
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
30
    }
31
    $ret[] = $block;
32
33
    // wfdownloads broken
34
    $block  = [];
35
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_broken'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...('wfdownloads_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...
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/wfdownloads/admin/brokendown.php';
38
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
39
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
40
    }
41
    $ret[] = $block;
42
43
    // wfdownloads modreq
44
    $block  = [];
45
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_mod'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...fix('wfdownloads_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...
46
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
47
        $block['adminlink'] = XOOPS_URL . '/modules/wfdownloads/admin/modifications.php';
48
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
49
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
50
    }
51
    $ret[] = $block;
52
53
    // wfdownloads reviews
54
    $block  = [];
55
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_reviews') . ' WHERE submit=0');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...') . ' WHERE submit=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...
56
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
57
        $block['adminlink'] = XOOPS_URL . '/modules/wfdownloads/admin/index.php?op=reviews';
58
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
59
        $block['lang_linkname'] = _PI_WAITING_REVIEWS;
60
    }
61
    $ret[] = $block;
62
63
    return $ret;
64
}
65