b_faqs_random_diduno_show()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 20
rs 10
cc 2
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * Module: SmartFAQ
5
 * Author: The SmartFactory <www.smartfactory.ca>
6
 * Licence: GNU
7
 */
8
9
use XoopsModules\Smartfaq\Constants;
10
use XoopsModules\Smartfaq\Helper;
11
12
/**
13
 * @return array
14
 */
15
function b_faqs_random_diduno_show()
16
{
17
    //    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
18
19
    $block = [];
20
21
    // Creating the faq handler object
22
    /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */
23
    $faqHandler = Helper::getInstance()->getHandler('Faq');
24
25
    // creating the FAQ object
26
    $faqsObj = $faqHandler->getRandomFaq('diduno', [Constants::SF_STATUS_PUBLISHED, Constants::SF_STATUS_NEW_ANSWER]);
0 ignored issues
show
Bug introduced by
array(XoopsModules\Smart...::SF_STATUS_NEW_ANSWER) of type array<integer,integer> is incompatible with the type string expected by parameter $status of XoopsModules\Smartfaq\FaqHandler::getRandomFaq(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
    $faqsObj = $faqHandler->getRandomFaq('diduno', /** @scrutinizer ignore-type */ [Constants::SF_STATUS_PUBLISHED, Constants::SF_STATUS_NEW_ANSWER]);
Loading history...
27
28
    if ($faqsObj) {
29
        $block['content']     = $faqsObj->diduno();
30
        $block['id']          = $faqsObj->faqid();
31
        $block['lang_answer'] = _MB_SF_MOREDETAILS;
32
    }
33
34
    return $block;
35
}
36