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

xoopstube.php ➔ b_waiting_xoopstube()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 34
Code Lines 25

Duplication

Lines 34
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
eloc 25
nc 8
nop 0
dl 34
loc 34
rs 8.5806
c 0
b 0
f 0
1
<?php
2
/*************************************************************************/
3
# Waiting Contents Extensible                                            #
4
# Plugin for module xoopstube                                            #
5
# alain01 - Frxoops                                                      #
6
#                                                                        #
7
# Last modified on 25.04.2013                                            #
8
/*************************************************************************/
9
/**
10
 * @return array
11
 */
12
function b_waiting_xoopstube()
13
{
14
        /** @var \XoopsMySQLDatabase $xoopsDB */
15
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
16
    $ret     = [];
17
    // xoopstube waiting
18
    $block  = [];
19
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' 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...
20
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
21
        $block['adminlink'] = XOOPS_URL . '/modules/xoopstube/admin/newvideos.php';
22
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
23
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
24
    }
25
    $ret[] = $block;
26
    // xoopstube broken
27
    $block  = [];
28
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xoopstube_broken'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...ix('xoopstube_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...
29
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
30
        $block['adminlink'] = XOOPS_URL . '/modules/xoopstube/admin/brokenvideo.php';
31
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
32
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
33
    }
34
    $ret[] = $block;
35
    // xoopstube modreq
36
    $block  = [];
37
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xoopstube_mod'));
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $xoopsDB->query('SELECT ...refix('xoopstube_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...
38
    if ($result) {
0 ignored issues
show
introduced by
$result is defined implicitly as null, thus it is always evaluated to false.
Loading history...
39
        $block['adminlink'] = XOOPS_URL . '/modules/xoopstube/admin/modifications.php';
40
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
41
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
42
    }
43
    $ret[] = $block;
44
45
    return $ret;
46
}
47