b_waiting_xfsection()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 27
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 17
nc 4
nop 0
dl 0
loc 27
rs 9.7
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
//
3
// xf-section ext waiting plugin
4
// author: Mel Bezos <[email protected], www.bezoops.net> 14-Oct-2005
5
//
6
/**
7
 * @return array
8
 */
9
function b_waiting_xfsection()
10
{
11
    /** @var \XoopsMySQLDatabase $xoopsDB */
12
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
13
    $ret     = [];
14
15
    // xf-section articles - waiting
16
    $block  = [];
17
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xfs_article') . ' WHERE published=0');
18
    if ($result) {
19
        $block['adminlink'] = XOOPS_URL . '/modules/xfsection/admin/allarticles.php?action=submitted';
20
        [$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

20
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
21
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
22
    }
23
    $ret[] = $block;
24
25
    // xf-section articles - attach broken
26
    $block  = [];
27
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xfs_broken') . '');
28
    if ($result) {
29
        $block['adminlink'] = XOOPS_URL . '/modules/xfsection/admin/brokendown.php?op=listBrokenDownloads';
30
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
31
        $block['lang_linkname'] = _PI_WAITING_FILES . '&nbsp;' . _PI_WAITING_BROKENS;
32
    }
33
    $ret[] = $block;
34
35
    return $ret;
36
}
37