Helper::getHandler()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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