Morefiles   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
c 0
b 0
f 0
dl 0
loc 76
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 10 1
A getInstance() 0 8 2
A getTemplatesUserMoreFile() 0 9 1
A write() 0 6 1
A __construct() 0 3 1
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Templates\User\Defstyle;
4
5
use XoopsModules\Modulebuilder;
6
use XoopsModules\Modulebuilder\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
 * modulebuilder module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops https://xoops.org 
26
 *                  Goffy https://myxoops.org
27
 *
28
 */
29
30
/**
31
 * class Morefiles.
32
 */
33
class Morefiles extends Files\CreateFile
34
{
35
    private $folder = null;
36
    private $extension = null;
37
38
    /**
39
     * @public function constructor
40
     * @param null
41
     */
42
    public function __construct()
43
    {
44
        parent::__construct();
45
    }
46
47
    /**
48
     * @static function getInstance
49
     * @param null
50
     * @return Morefiles
51
     */
52
    public static function getInstance()
53
    {
54
        static $instance = false;
55
        if (!$instance) {
56
            $instance = new self();
57
        }
58
59
        return $instance;
60
    }
61
62
    /**
63
     * @public function write
64
     * @param        $module
65
     * @param string $filename
66
     * @param        $folder
67
     * @param        $extension
68
     */
69
    public function write($module, $folder, $filename, $extension)
70
    {
71
        $this->setModule($module);
72
        $this->setFileName($filename);
73
        $this->folder    = $folder;
74
        $this->extension = $extension;
75
    }
76
77
    /**
78
     * @private function getTemplatesUserMoreFile
79
     * @param null
80
     *
81
     * @return string
82
     */
83
    private function getTemplatesUserMoreFile()
84
    {
85
        $ret = <<<'EOT'
86
<div class="panel">
87
	Pleace! Enter here your template code here
88
</div>
89
EOT;
90
91
        return $ret;
92
    }
93
94
    /**
95
     * @public function render
96
     * @param null
97
     * @return bool|string
98
     */
99
    public function render()
100
    {
101
        $module        = $this->getModule();
102
        $filename      = $this->getFileName();
103
        $moduleDirname = $module->getVar('mod_dirname');
104
        $content       = $this->getTemplatesUserMoreFile();
105
106
        $this->create($moduleDirname, $this->folder, $filename . '.' . $this->extension, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
107
108
        return $this->renderFile();
109
    }
110
}
111