AdminFooter::getInstance()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php namespace XoopsModules\Tdmcreate\Files\Admin;
2
use XoopsModules\Tdmcreate;
3
use XoopsModules\Tdmcreate\Files;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
/**
15
 * tdmcreate module.
16
 *
17
 * @copyright       XOOPS Project (https://xoops.org)
18
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
19
 *
20
 * @since           2.5.0
21
 *
22
 * @author          Txmod Xoops http://www.txmodxoops.org
23
 *
24
 * @version         $Id: 1.91 admin_footer.php 12258 2014-01-02 09:33:29Z timgno $
25
 */
26
27
/**
28
 * Class AdminFooter.
29
 */
30
class AdminFooter extends Files\CreateFile
31
{
32
    /**
33
    * @var string
34
    */
35
    private $xc = null;
36
37
    /**
38
    *  @public function constructor
39
    *  @param null
40
    */
41
42
    public function __construct()
43
    {
44
        parent::__construct();
45
        $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...
46
        $this->phpcode = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...ePhpCode::getInstance() of type XoopsModules\Tdmcreate\Files\CreatePhpCode is incompatible with the declared type string of property $phpcode.

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...
47
    }
48
49
    /**
50
    *  @static function getInstance
51
    * @return AdminFooter
52
    */
53
    public static function getInstance()
54
    {
55
        static $instance = false;
56
        if (!$instance) {
57
            $instance = new self();
58
        }
59
60
        return $instance;
61
    }
62
63
    /**
64
    *  @public function write
65
    *  @param string $module
66
    *  @param string $filename
67
    */
68
    public function write($module, $filename)
69
    {
70
        $this->setModule($module);
71
        $this->setFileName($filename);
72
    }
73
74
    /**
75
    *  @public function render
76
    *  @param null
77
    * @return bool|string
78
    */
79
    public function render()
80
    {
81
        $module = $this->getModule();
82
        $filename = $this->getFileName();
83
        $moduleDirname = $module->getVar('mod_dirname');
84
        $content = $this->getHeaderFilesComments($module, $filename);
85
        $isset = $this->phpcode->getPhpCodeIsset('templateMain');
86
        $display = "\t".$this->xc->getXcTplAssign('maintainedby', '$'.$moduleDirname."->getConfig('maintainedby')");
87
        $display .= "\t".$this->phpcode->getPhpCodeRemoveCarriageReturn($this->xc->getXcTplDisplay(), '', "\r");
88
        $content .= $this->phpcode->getPhpCodeConditions($isset, '', '', $display, false, '').PHP_EOL;
89
        $content .= $this->xc->getXcCPFooter();
90
91
        $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
92
93
        return $this->renderFile();
94
    }
95
}
96