AdminAbout   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getInstance() 0 8 2
A write() 0 4 1
A render() 0 17 1
1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\Admin;
4
5
use XoopsModules\Tdmcreate;
6
use XoopsModules\Tdmcreate\Files;
7
8
/*
9
 You may not change or alter any portion of this comment or credits
10
 of supporting developers from this source code or any supporting source code
11
 which is considered copyrighted (c) material of the original comment or credit authors.
12
13
 This program is distributed in the hope that it will be useful,
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
/**
18
 * tdmcreate module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops http://www.txmodxoops.org
26
 *
27
 */
28
29
/**
30
 * Class AdminAbout.
31
 */
32
class AdminAbout extends Files\CreateFile
33
{
34
    /**
35
     * @var mixed
36
     */
37
    private $axc = null;
38
39
    /**
40
     * @var string
41
     */
42
    private $xc = null;
43
44
    /**
45
     * @public function constructor
46
     * @param null
47
     */
48
    public function __construct()
49
    {
50
        parent::__construct();
51
        $this->xc  = Tdmcreate\Files\CreateXoopsCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...oopsCode::getInstance() of type XoopsModules\Tdmcreate\Files\CreateXoopsCode is incompatible with the declared type string of property $xc.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
52
        $this->axc = Tdmcreate\Files\Admin\AdminXoopsCode::getInstance();
53
    }
54
55
    /**
56
     * @static function getInstance
57
     * @param null
58
     * @return AdminAbout
59
     */
60
    public static function getInstance()
61
    {
62
        static $instance = false;
63
        if (!$instance) {
64
            $instance = new self();
65
        }
66
67
        return $instance;
68
    }
69
70
    /**
71
     * @public function write
72
     * @param string $module
73
     * @param string $filename
74
     */
75
    public function write($module, $filename)
76
    {
77
        $this->setModule($module);
78
        $this->setFileName($filename);
79
    }
80
81
    /**
82
     * @public function render
83
     * @param null
84
     * @return bool|string
85
     */
86
    public function render()
87
    {
88
        $module          = $this->getModule();
89
        $filename        = $this->getFileName();
90
        $moduleDirname   = $module->getVar('mod_dirname');
91
        $moduleDonations = $module->getVar('mod_donations');
92
        $content         = $this->getHeaderFilesComments($module);
93
        $content         .= $this->getInclude();
94
        $content         .= $this->axc->getAdminTemplateMain($moduleDirname, 'about');
95
        $content         .= $this->xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('about.php')");
96
        $content         .= $this->getSimpleString("\$adminObject->setPaypal('{$moduleDonations}');");
97
        $content         .= $this->xc->getXcXoopsTplAssign('about', "\$adminObject->renderAbout(false)");
98
        $content         .= $this->getInclude('footer');
99
100
        $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
101
102
        return $this->renderFile();
103
    }
104
}
105