Completed
Pull Request — master (#599)
by Richard
17:07
created

PublisherMainmenuPlugin::mainmenu()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 0
loc 16
rs 10
c 1
b 0
f 0
1
<?php
2
3
//namespace XoopsModules\Publisher\Plugin;
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
use MainmenuPluginInterface;
16
use Xoops;
17
18
/**
19
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
20
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
21
 * @author          trabis <[email protected]>
22
 */
23
class PublisherMainmenuPlugin implements MainmenuPluginInterface
24
{
25
    /**
26
     * @return array
27
     */
28
    public function mainmenu()
29
    {
30
        $helper = Xoops::getModuleHelper(\basename(\dirname(\dirname(__DIR__))));
31
        $subMenu = [];
32
        // Prevent wasting resources
33
        if ($helper->isCurrentModule()) {
34
            //Todo: Implement submenu;
35
        }
36
37
        $ret[] = [
0 ignored issues
show
Comprehensibility Best Practice introduced by
$ret was never initialized. Although not strictly required by PHP, it is generally a good practice to add $ret = array(); before regardless.
Loading history...
38
            'name' => $helper->getModule()->getVar('name'),
39
            'link' => $helper->url(),
40
            'subMenu' => $subMenu,
41
        ];
42
43
        return $ret;
44
    }
45
}
46