Completed
Pull Request — master (#489)
by Richard
10:39
created

Breadcrumb   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 43
rs 10
ccs 0
cts 3
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A setItems() 0 5 1
A render() 0 4 1
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
namespace Xmf\Template;
13
14
/**
15
 * Breadcrumb
16
 *
17
 * @category  Xmf\Template\Breadcrumb
18
 * @package   Xmf
19
 * @author    trabis <[email protected]>
20
 * @author    The SmartFactory <www.smartfactory.ca>
21
 * @copyright 2011-2016 XOOPS Project (http://xoops.org)
22
 * @license   GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
23
 * @version   Release: 1.0
24
 * @link      http://xoops.org
25
 * @since     1.0
26
 */
27
class Breadcrumb extends AbstractTemplate
28
{
29
    /**
30
     * @var array
31
     */
32
    private $items = array();
33
34
    /**
35
     * initialization run by parent::__construct
36
     *
37
     * @return void
38
     */
39
    protected function init()
40
    {
41
        $this->setTemplate('module:xmf/xmf_breadcrumb.tpl');
42
    }
43
44
    /**
45
     * Set the items to be shown. Items are specified as an array of
46
     * breadcrumb items. Each breadcrumb item is an array of:
47
     *  - 'caption' => ready to display string item,
48
     *  - 'link' => url (omit to disable link on this item)
49
     *
50
     * @param array $items array of breadcrumb items
51
     *
52
     * @return Breadcrumb
53
     */
54
    public function setItems($items)
55
    {
56
        $this->items = $items;
57
        return $this;
58
    }
59
60
    /**
61
     * Assigning content to template
62
     *
63
     * @return void
64
     */
65
    protected function render()
66
    {
67
        $this->tpl->assign('xmf_breadcrumb_items', $this->items);
68
    }
69
}
70