CssAdminStyles   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 56
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 14 1
A getInstance() 0 8 2
A write() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Assets\Css\Admin;
4
5
use XoopsModules\Modulebuilder\Files;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 */
16
/**
17
 * modulebuilder module.
18
 *
19
 * @copyright       XOOPS Project (https://xoops.org)
20
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
21
 *
22
 * @since           2.5.0
23
 *
24
 * @author          Txmod Xoops https://xoops.org 
25
 *                  Goffy https://myxoops.org
26
 *
27
 */
28
29
/**
30
 * Class CssAdminStyles.
31
 */
32
class CssAdminStyles extends Files\CreateFile
33
{
34
    /**
35
     * @public function constructor
36
     * @param null
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
    }
42
43
    /**
44
     * @static function getInstance
45
     * @param null
46
     * @return CssAdminStyles
47
     */
48
    public static function getInstance()
49
    {
50
        static $instance = false;
51
        if (!$instance) {
52
            $instance = new self();
53
        }
54
55
        return $instance;
56
    }
57
58
    /**
59
     * @public function write
60
     * @param $module
61
     * @param $filename
62
     */
63
    public function write($module, $filename)
64
    {
65
        $this->setModule($module);
66
        $this->setFileName($filename);
67
    }
68
69
    /**
70
     * @public function render
71
     * @param null
72
     * @return bool|string
73
     */
74
    public function render()
75
    {
76
        $module        = $this->getModule();
77
        $filename      = $this->getFileName();
78
        $moduleDirname = $module->getVar('mod_dirname');
79
        $content       = $this->getHeaderFilesComments($module, '@charset "UTF-8";');
80
        $content       .= <<<'EOT'
81
img {
82
	max-width: 200px;
83
}
84
EOT;
85
        $this->create($moduleDirname, 'assets/css/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
86
87
        return $this->renderFile();
88
    }
89
}
90