helpers.php ➔ newTab()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
if(! function_exists('hasSub')){
4
    /**
5
     * Check menu has sub
6
     *
7
     * @author Alireza Josheghani <[email protected]>
8
     * @since  8 Oct 2016
9
     * @param  $menu
10
     * @return bool
11
     */
12
    function hasSub($menu)
13
    {
14
        // check menu has sub
15
        if(! empty($menu['sub'])) {
16
            return true;
17
        }
18
19
        return false;
20
    }
21
}
22
23
if(! function_exists('itemIcon')){
24
    /**
25
     * Print item icon
26
     *
27
     * @author Alireza Josheghani <[email protected]>
28
     * @since  8 Oct 2016
29
     * @param  $value
30
     * @return string
31
     */
32 View Code Duplication
    function itemIcon($value)
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
35
        $tag = $value['tag'];
36
37
        if($value['tag'] === null) {
38
            $tag = 'i';
39
        }
40
41
        return '<' . $tag . ' class="' . $value['value'] . '"></' . $tag . '>';
42
    }
43
}
44
45
if(! function_exists('newTab')){
46
    /**
47
     * Print item new_tab option
48
     *
49
     * @author Alireza Josheghani <[email protected]>
50
     * @since  8 Oct 2016
51
     * @param  $newTab
52
     * @return null|string
53
     */
54
    function newTab($newTab)
55
    {
56
        if($newTab) {
57
            return 'target="_blank"';
58
        }
59
60
        return null;
61
    }
62
}