b_waiting_xoopstube()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 34
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 24
nc 8
nop 0
dl 0
loc 34
rs 9.536
c 1
b 0
f 0
1
<?php declare(strict_types=1);
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');
20
    if ($result) {
21
        $block['adminlink'] = XOOPS_URL . '/modules/xoopstube/admin/newvideos.php';
22
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
0 ignored issues
show
Bug introduced by
It seems like $result can also be of type true; however, parameter $result of XoopsMySQLDatabase::fetchRow() does only seem to accept mysqli_result, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
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'));
29
    if ($result) {
30
        $block['adminlink'] = XOOPS_URL . '/modules/xoopstube/admin/brokenvideo.php';
31
        [$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'));
38
    if ($result) {
39
        $block['adminlink'] = XOOPS_URL . '/modules/xoopstube/admin/modifications.php';
40
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
41
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
42
    }
43
    $ret[] = $block;
44
45
    return $ret;
46
}
47