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
    Helper
28
};
29
30
/**
31
 * @return array
32
 */
33
function b_sitemap_xoopsfaq()
34
{
35
    /** @var Xoopsfaq\CategoryHandler $categoryHandler */
36
    /** @var Xoopsfaq\Helper $helper */
37
    $myts = \MyTextSanitizer::getInstance();
0 ignored issues
show
Unused Code introduced by
The assignment to $myts is dead and can be removed.
Loading history...
38
39
    $moduleDirName   = \basename(\dirname(__DIR__));
0 ignored issues
show
Unused Code introduced by
The assignment to $moduleDirName is dead and can be removed.
Loading history...
40
    $helper          = Helper::getInstance();
41
    $categoryHandler = $helper->getHandler('Category');
42
    $catList         = $categoryHandler->getList();
43
44
    $retVal = [];
45
    foreach ($catList as $id => $title) {
46
        $retVal['parent'][] = [
47
            'id'    => $id,
48
            'title' => htmlspecialchars($title, ENT_QUOTES | ENT_HTML5),
49
            'url'   => $helper->url('index.php?cat_id=' . $id),
50
        ];
51
    }
52
53
    return $retVal;
54
}
55