b_waiting_wfsection()   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
// wf-sections ext waiting plugin
4
// author: karedokx <[email protected]> 15-Apr-2005
5
//
6
/**
7
 * @return array
8
 */
9
function b_waiting_wfsection()
10
{
11
    /** @var \XoopsMySQLDatabase $xoopsDB */
12
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
13
    $ret     = [];
14
15
    // wf-section articles - new
16
    $block  = [];
17
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfs_article') . ' WHERE published=0');
18
    if ($result) {
19
        $block['adminlink'] = XOOPS_URL . '/modules/wfsection/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
    // wf-section articles - modified
26
    $block  = [];
27
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfs_article_mod') . '');
28
    if ($result) {
29
        $block['adminlink'] = XOOPS_URL . '/modules/wfsection/admin/modified.php';
30
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
31
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
32
    }
33
    $ret[] = $block;
34
35
    return $ret;
36
}
37