Passed
Push — master ( 77f10d...b1f89f )
by Michael
03:06
created

Helper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHandler() 0 9 1
A init() 0 4 1
A loadConfig() 0 3 1
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       The XOOPS Project http://sourceforge.net/projects/xoops/
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
0 ignored issues
show
Bug introduced by
The type Xoops\Module\Helper\HelperAbstract was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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();
0 ignored issues
show
Bug introduced by
The method getConnection() does not exist on XoopsDatabaseFactory. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
        /** @scrutinizer ignore-call */ 
55
        $db = \XoopsDatabaseFactory::getConnection();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55
        $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler';
56
        $ret = new $class($db);
57
58
        return $ret;
59
    }
60
}
61