Passed
Pull Request — master (#8)
by Michael
11:33
created

Breadcrumb   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 29
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addLink() 0 5 1
A render() 0 2 1
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Myiframe\Common;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * Breadcrumb Class
17
 *
18
 * @copyright   XOOPS Project (https://xoops.org)
19
 * @license     https://www.fsf.org/copyleft/gpl.html GNU public license
20
 * @author      lucio <[email protected]>
21
 */
22
23
/**
24
 * Class Breadcrumb
25
 */
26
class Breadcrumb
27
{
28
    public  $dirname;
29
    private $bread = [];
30
31
    public function __construct()
32
    {
33
        $this->dirname = \basename(\dirname(__DIR__, 2));
34
    }
35
36
    /**
37
     * Add link to breadcrumb
38
     *
39
     * @param string $title
40
     * @param string $link
41
     */
42
    public function addLink($title = '', $link = ''): void
43
    {
44
        $this->bread[] = [
45
            'link'  => $link,
46
            'title' => $title,
47
        ];
48
    }
49
50
    /**
51
     * Render BreadCrumb
52
     */
53
    public function render(): void
54
    {
55
        /*
56
        TODO if you want to use the render code below,
57
        1) create ./templates/chess_common_breadcrumb.tpl)
58
        2) add declaration to  xoops_version.php
59
        */
60
        /*
61
        if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) {
62
            require $GLOBALS['xoops']->path('class/theme.php');
63
64
            $GLOBALS['xoTheme'] = new \xos_opal_Theme();
65
        }
66
67
        require $GLOBALS['xoops']->path('class/template.php');
68
69
        $breadcrumbTpl = new \XoopsTpl();
70
71
        $breadcrumbTpl->assign('breadcrumb', $this->bread);
72
73
        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
74
75
        unset($breadcrumbTpl);
76
77
        return $html;
78
        */
79
    }
80
}
81