1 | <?php namespace XoopsModules\Xdonations; |
||
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 | /** |
||
14 | * @copyright XOOPS Project https://xoops.org/ |
||
15 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
16 | * @package |
||
17 | * @since |
||
18 | * @author XOOPS Development Team |
||
19 | */ |
||
20 | defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
21 | |||
22 | /** |
||
23 | * Class Helper |
||
24 | */ |
||
25 | class Helper extends \Xmf\Module\Helper |
||
26 | { |
||
27 | public $debug; |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * @param bool $debug |
||
32 | */ |
||
33 | public function __construct($debug = false) |
||
34 | { |
||
35 | $this->debug = $debug; |
||
36 | $moduleDirName = basename(dirname(__DIR__)); |
||
37 | parent::__construct($moduleDirName); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param bool $debug |
||
42 | * |
||
43 | * @return \XoopsModules\Xdonations\Helper |
||
44 | */ |
||
45 | public static function getInstance($debug = false) |
||
46 | { |
||
47 | static $instance; |
||
48 | if (null === $instance) { |
||
49 | $instance = new static($debug); |
||
50 | } |
||
51 | |||
52 | return $instance; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getDirname() |
||
59 | { |
||
60 | return $this->dirname; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Get an Object Handler |
||
65 | * |
||
66 | * @param string $name name of handler to load |
||
67 | * |
||
68 | * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler |
||
69 | */ |
||
70 | public function getHandler($name) |
||
71 | { |
||
72 | $ret = false; |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
73 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||
74 | $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; |
||
75 | $ret = new $class($db); |
||
76 | return $ret; |
||
77 | } |
||
78 | } |
||
79 |