b_waiting_PDlinks()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 37
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 24
nc 8
nop 0
dl 0
loc 37
rs 9.536
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
# Waiting Contents Extensible                                            #
4
# Plugin for module PDlinks                                              #
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_PDlinks()
15
{
16
    /** @var \XoopsMySQLDatabase $xoopsDB */
17
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
18
    $ret     = [];
19
20
    // PDlinks waiting
21
    $block  = [];
22
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('PDlinks_links') . ' WHERE status=0');
23
    if ($result) {
24
        $block['adminlink'] = XOOPS_URL . '/modules/PDlinks/admin/newlinks.php';
25
        [$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

25
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
26
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
27
    }
28
    $ret[] = $block;
29
30
    // PDlinks broken
31
    $block  = [];
32
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('PDlinks_broken'));
33
    if ($result) {
34
        $block['adminlink'] = XOOPS_URL . '/modules/PDlinks/admin/brokenlink.php';
35
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
36
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
37
    }
38
    $ret[] = $block;
39
40
    // PDlinks modreq
41
    $block  = [];
42
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('PDlinks_mod'));
43
    if ($result) {
44
        $block['adminlink'] = XOOPS_URL . '/modules/PDlinks/admin/index.php?op=listModReq';
45
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
46
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
47
    }
48
    $ret[] = $block;
49
50
    return $ret;
51
}
52