assessment.php ➔ b_sitemap_assessment()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 31
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 13
nc 2
nop 0
dl 0
loc 31
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * @return array
4
 */
5
function b_sitemap_assessment()
6
{
7
    $db = XoopsDatabaseFactory::getDatabaseConnection();
8
9
    $myts = MyTextSanitizer::getInstance();
10
11
    global $xoopsConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
12
13
    /*  if (file_exists(XOOPS_ROOT_PATH . '/modules/xoopspoll/language/' . $xoopsConfig['language'] . '/main.php')) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
14
            include_once(XOOPS_ROOT_PATH . '/modules/xoopspoll/language/' . $xoopsConfig['language'] . '/main.php');
15
        }
16
    */
17
    $sitemap = array();
18
    $result  = $db->query('SELECT cod_prova,titulo FROM ' . $db->prefix('assessment_provas') . ' ');
19
    $i       = 0;
20
    while ($prova_linha = $db->fetchArray($result)) {
21
        $sitemap['parent'][$i]['id'] = $prova_linha['cod_prova'];
22
23
        $sitemap['parent'][$i]['title'] = $myts->makeTboxData4Show($prova_linha['titulo']);
24
25
        $sitemap['parent'][$i]['url'] = 'verprova.php?cod_prova=' . $prova_linha['cod_prova'];
26
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
90% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
27
                $sitemap['parent'][$i]['child'][$i]['id']=$prova_linha["cod_prova"];
28
                $sitemap['parent'][$i]['child'][$i]['title']="titulo filho";
29
                $sitemap['parent'][$i]['child'][$i]['image']=2;
30
                $sitemap['parent'][$i]['child'][$i]['url']="verprova.php?cod_prova=".$prova_linha["cod_prova"];*/
31
        ++$i;
32
    }
33
34
    return $sitemap;
35
}
36