Passed
Pull Request — master (#70)
by Pierre-Henry
03:15
created

class/Helper.php (3 issues)

Labels
Severity
1
<?php namespace XoopsModules\Newbb;
2
3
/*
4
     You may not change or alter any portion of this comment or credits
5
     of supporting developers from this source code or any supporting source code
6
     which is considered copyrighted (c) material of the original comment or credit authors.
7
8
     This program is distributed in the hope that it will be useful,
9
     but WITHOUT ANY WARRANTY; without even the implied warranty of
10
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
    */
12
/**
13
 * NewBB module for xoops
14
 *
15
 * @copyright       XOOPS Project (https://xoops.org)
16
 * @license         GPL 2.0 or later
17
 * @package         newbb
18
 * @since           5.0.0
19
 * @author          XOOPS Development Team <[email protected]> - <https://xoops.org>
20
 */
21
22
//defined('XOOPS_ROOT_PATH') || die('Restricted access');
23
24
/**
25
 * Class Helper
26
 */
27
class Helper extends \Xmf\Module\Helper
28
{
29
    public $debug;
30
31
    /**
32
     * @internal param $debug
33
     * @param bool $debug
34
     */
35
    protected function __construct($debug = false)
36
    {
37
        $this->debug   = $debug;
38
        parent::__construct(basename(dirname(__DIR__)));
39
    }
40
41
    /**
42
     * @param bool $debug
43
     *
44
     * @return \XoopsModules\Newbb\Helper
45
     */
46
    public static function getInstance($debug = false)
47
    {
48
        static $instance;
49
        if (null === $instance) {
50
            $instance = new static($debug);
51
        }
52
53
        return $instance;
54
    }
55
56
    /**
57
     * @param null|string $name
58
     * @param null|string $value
59
     *
60
     * @return mixed
61
     */
62
    public function setConfig($name = null, $value = null)
63
    {
64
        if (null === $this->configs) {
65
            $this->initConfig();
66
        }
67
        $this->configs[$name] = $value;
68
        $this->addLog("Setting config '{$name}' : " . $this->configs[$name]);
69
70
        return $this->configs[$name];
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getDirname()
77
    {
78
        return $this->dirname;
79
    }
80
81
    /**
82
     * Get an Object Handler
83
     *
84
     * @param string $name name of handler to load
85
     *
86
     * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler
0 ignored issues
show
The type XoopsPersistableObjectHandler 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...
The type XoopsObjectHandler 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...
87
     */
88
    public function getHandler($name)
89
    {
90
        $db    = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
The type XoopsDatabaseFactory 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...
91
        $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler';
92
        $ret   = new $class($db);
93
94
        return $ret;
95
    }
96
}
97