PluginHandler   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 8

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A triggerEvent() 0 15 4
A includeLangFile() 0 10 3
1
<?php
2
3
namespace XoopsModules\Extgallery;
4
5
/**
6
 * ExtGallery Class Manager
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 *
15
 * @copyright   {@link https://xoops.org/ XOOPS Project}
16
 * @license     GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 * @author      Zoullou (http://www.zoullou.net)
18
 * @package     ExtGallery
19
 */
20
21
use XoopsDatabase;
22
use XoopsModules\Extgallery;
23
24
25
/**
26
 * Class Extgallery\PluginHandler
27
 */
28
class PluginHandler
29
{
30
    /**
31
     * Extgallery\PluginHandler constructor.
32
     * @param \XoopsDatabase|null $db
33
     */
34
    public function __construct(XoopsDatabase $db = null)
35
    {
36
    }
37
38
    /**
39
     * @param $event
40
     * @param $param
41
     */
42
    public function triggerEvent($event, &$param)
43
    {
44
        require XOOPS_ROOT_PATH . '/modules/extgallery/plugin/plugin.php';
45
        if (is_iterable($extgalleryPlugin)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $extgalleryPlugin seems to be never defined.
Loading history...
46
            foreach ($extgalleryPlugin as $plugin => $status) {
47
                if (!$status) {
48
                    continue;
49
                }
50
51
                //            require_once XOOPS_ROOT_PATH . "/modules/extgallery/plugin/$plugin/$plugin.php";
52
53
                $class = 'Extgallery' . \ucfirst($plugin);
54
55
                $pluginObj = new $class();
56
                $pluginObj->$event($param);
57
            }
58
        }
59
    }
60
61
    public function includeLangFile()
62
    {
63
        require_once XOOPS_ROOT_PATH . '/modules/extgallery/plugin/plugin.php';
64
65
        foreach ($extgalleryPlugin as $plugin => $status) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $extgalleryPlugin seems to be never defined.
Loading history...
66
            if (!$status) {
67
                continue;
68
            }
69
70
            require_once XOOPS_ROOT_PATH . "/modules/extgallery/plugin/$plugin/language/english/main.php";
71
        }
72
    }
73
}
74