b_waiting_xmdoc()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 11
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 17
rs 9.9
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * xmdoc module
14
 *
15
 * @copyright       XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 * @author          Mage Gregory (AKA Mage)
18
 */
19
 
20
/**
21
 * @return array
22
 */
23
function b_waiting_xmdoc()
24
{
25
    /** @var \XoopsMySQLDatabase $xoopsDB */
26
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
27
    $ret     = [];
28
    $block   = [];
29
    $sql    = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xmdoc_document') . ' WHERE document_status=0';
30
    $result = $xoopsDB->query($sql);
31
    if ($result) {
32
        $block['adminlink'] = XOOPS_URL . '/modules/xmdoc/admin/document.php?category=0&status=0';
33
        [$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

33
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
34
        $block['lang_linkname'] = _PI_WAITING_DOC;
35
    }
36
37
    $ret[] = $block;
38
39
    return $ret;
40
}
41