b_sitemap_xoopsfaq()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 12
c 2
b 0
f 0
nc 2
nop 0
dl 0
loc 21
rs 9.8666
1
<?php declare(strict_types=1);
2
/*
3
 You may not change or alter any portion of this comment or credits of
4
 supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit
6
 authors.
7
8
 This program is distributed in the hope that it will be useful, but
9
 WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * Module: XoopsFaq
15
 *
16
 * Module Configuration file
17
 *
18
 * @author          ZySpec
19
 * @author          XOOPS Module Development Team
20
 * @copyright       https://xoops.org 2001-2017 &copy; XOOPS Project
21
 * @license         https://www.gnu.org/licenses/gpl-2.0.html GNU Public License
22
 * @since           1.2.5
23
 */
24
25
use XoopsModules\Xoopsfaq;
26
use XoopsModules\Xoopsfaq\{
27
    CategoryHandler,
28
    Helper
29
};
30
31
/**
32
 * @return array
33
 */
34
function b_sitemap_xoopsfaq(): array
35
{
36
    $myts = \MyTextSanitizer::getInstance();
0 ignored issues
show
Unused Code introduced by
The assignment to $myts is dead and can be removed.
Loading history...
37
38
    $moduleDirName = \basename(\dirname(__DIR__));
0 ignored issues
show
Unused Code introduced by
The assignment to $moduleDirName is dead and can be removed.
Loading history...
39
    /** @var Helper $helper */
40
    $helper = Helper::getInstance();
41
    /** @var CategoryHandler $categoryHandler */
42
    $categoryHandler = $helper->getHandler('Category');
43
    $catList         = $categoryHandler->getList();
44
45
    $retVal = [];
46
    foreach ($catList as $id => $title) {
47
        $retVal['parent'][] = [
48
            'id'    => $id,
49
            'title' => htmlspecialchars((string)$title, ENT_QUOTES | ENT_HTML5),
50
            'url'   => $helper->url('index.php?cat_id=' . $id),
51
        ];
52
    }
53
54
    return $retVal;
55
}
56