Helper::loadConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace XoopsModules\Xooghost;
4
5
/**
6
 * Xooghost module
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       XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 * @package         Xooghost
18
 * @since           2.6.0
19
 * @author          Laurent JEN (Aka DuGris)
20
 */
21
class Helper extends \Xoops\Module\Helper\HelperAbstract
22
{
23
    /**
24
     * Init the module
25
     *
26
     * @return null|void
27
     */
28
    public function init()
29
    {
30
        $this->setDirname(basename(dirname(__DIR__)));
31
        $this->loadLanguage('common');
32
        $this->loadLanguage('preferences');
33
    }
34
35
    /**
36
     * @return \Xoops\Module\Helper\HelperAbstract
37
     */
38
    public static function getInstance()
39
    {
40
        return parent::getInstance();
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46
    public function loadConfig()
47
    {
48
        return \XoopsModules\Xooghost\Preferences::getInstance()->getConfig();
49
    }
50
51
    /**
52
     * Get an Object Handler
53
     *
54
     * @param string $name name of handler to load
55
     *
56
     * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler
57
     */
58
    public function getHandler($name)
59
    {
60
        $ret = false;
0 ignored issues
show
Unused Code introduced by
The assignment to $ret is dead and can be removed.
Loading history...
61
        //        /** @var Connection $db */
62
        $db = \XoopsDatabaseFactory::getConnection();
63
        $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler';
64
        $ret = new $class($db);
65
66
        return $ret;
67
    }
68
}
69