AssetHelper::link_css()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
/**
3
 * Asset Helper
4
 *
5
 * A super-simple way to generate tags for including css and js files in CodeIgniter
6
 *
7
 * @author  Christian Leo-Pernold [email protected]
8
 * @link    https://github.com/mazedlx/asset_helper
9
 * @license http://www.opensource.org/licenses/mit-license
10
 * @package AssetHelper
11
 * @version 1.0.1
12
 */
13
14
namespace AssetHelper;
15
16
class AssetHelper
17
{
18
    public function __construct()
19
    {
20
21
    }
22
23
    /**
24
     * link_css()
25
     *
26
     * Creates the link tag for a local CSS file from the assets/css directory
27
     *
28
     * @access  public
29
     * @param   string $filename
30
     * @param   string $media
31
     * @return  string
32
     */
33
    public function link_css($filename, $media = null)
34
    {
35
        if (isset($media)) {
36
            $media = 'media="'.$media.'"';
37
        }
38
        $string = '<link rel="stylesheet" type="text/css" '.$media.' href="assets/css/'.$filename.'">';
39
        return $string;
40
    }
41
42
    /**
43
     * link_js
44
     *
45
     * Creates the link tag for a local JavaScript File from the assets/js directory
46
     *
47
     * @access  public
48
     * @param   string $filename
49
     * @param   string $additional
50
     * @return  string
51
     */
52
    public function link_js($filename, $additional = null)
53
    {
54
        $string = '<script type="text/javascript" src="assets/js/'.$filename.'" '.$additional.'></script>';
55
        return $string;
56
    }
57
}
58