b_waiting_xfguestbook()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 0
loc 14
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @return array
5
 */
6
function b_waiting_xfguestbook()
7
{
8
    /** @var \XoopsMySQLDatabase $xoopsDB */
9
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
10
    $block   = [];
11
12
    $result = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix('xfguestbook_msg') . ' WHERE moderate = 1');
13
    if ($result) {
14
        $block['adminlink'] = XOOPS_URL . '/modules/xfguestbook/admin/index.php?action=waiting';
15
        [$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

15
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
16
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
0 ignored issues
show
Bug introduced by
The constant _PI_WAITING_WAITINGS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
17
    }
18
19
    return $block;
20
}
21