Completed
Push — master ( 6b7a6d...74143b )
by Gino
20s
created

CssSelectors::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: 1.91 CssSelectors.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class CssSelectors.
27
 */
28
class CssSelectors
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /**
31
     *  @static function getInstance
32
     *  @param null
33
     *
34
     * @return CssSelectors
35
     */
36
    public static function getInstance()
37
    {
38
        static $instance = false;
39
        if (!$instance) {
40
            $instance = new self();
41
        }
42
43
        return $instance;
44
    }
45
46
    /**
47
     * @public function geCssComment
48
     * @param string $comment
49
     * @param string $t
50
     * @return string
51
     */
52
    public function geCssComment($comment, $t)
53
    {
54
		$ret = ('' != $comment) ? "{$t}/* {$comment} */" : '';
55
		
56
		return $ret;
57
    }
58
59
    /**
60
     * @public function geCssSelector
61
     * @param string $selector
62
     * @param mixed  $content
63
     * @param string $t
64
     * @return string
65
     */
66
    public function geCssSelector($selector, $content, $t)
67
    {
68
        $ret = '';
69
		if(is_array($selector)) {
70
			$ret .= $t. implode("\n", $selector) . ' {';
71
		} else {
72
			$ret .= $selector . ' {';
73
		}		
74
		if(is_array($content)) {
75
			$ret .= $t. implode("\n", $content) . ';';
76
		} else {
77
			$ret .= $content . ';';
78
		}
79
		$ret = '}';
80
		
81
		return $ret;
82
    }
83
}
84