LanguageDefines::getAboveDefines()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php namespace XoopsModules\Tdmcreate\Files\Language;
2
3
use XoopsModules\Tdmcreate;
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: LanguageDefines.php 12258 2014-01-02 09:33:29Z timgno $
25
 */
26
27
/**
28
 * Class LanguageDefines.
29
 */
30
class LanguageDefines
31
{
32
    /**
33
     * @var mixed
34
     */
35
    protected $defines;
36
37
    /**
38
     *  @public function constructor
39
     *  @param null
40
     */
41
    public function __construct()
42
    {
43
        $this->phpcode = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property phpcode does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
44
    }
45
46
    /**
47
     *  @static function getInstance
48
     *  @param null
49
     * @return LanguageDefines
50
     */
51
    public static function getInstance()
52
    {
53
        static $instance = false;
54
        if (!$instance) {
55
            $instance = new self();
56
        }
57
58
        return $instance;
59
    }
60
61
    /**
62
     *  @public function getAboveHeadDefines
63
     *  @param string $string
64
     *  @return string
65
     */
66
    public function getAboveHeadDefines($string)
67
    {
68
        return "// ---------------- {$string} ----------------\n";
69
    }
70
71
    /**
72
     *  @public function getAboveDefines
73
     *  @param string $string
74
     *  @return string
75
     */
76
    public function getAboveDefines($string)
77
    {
78
        return "// {$string}\n";
79
    }
80
81
    /**
82
     *  @public function getDefine
83
     *  @param string $language
84
     *  @param string $defined
85
     *  @param string $description
86
     *  @param bool   $usedoubleqoute
87
     *  @return string
88
     */
89
    public function getDefine($language, $defined, $description, $usedoubleqoute = false)
90
    {
91
        $defined = mb_strtoupper($defined);
92
93
        if ($usedoubleqoute) {
94
            $ret = $this->phpcode->getPhpCodeDefine("{$language}{$defined}", "\"{$description}\"");
95
        } else {
96
            $ret = $this->phpcode->getPhpCodeDefine("{$language}{$defined}", "'" . $description . "'");
97
        }
98
99
        return $ret;
100
    }
101
102
    /**
103
     *  @public function getBelowDefines
104
     *  @param string $string
105
     *
106
     * @return string
107
     */
108
    public function getBelowDefines($string)
109
    {
110
        return "// ---------------- {$string} ----------------";
111
    }
112
}
113