GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Icon::render()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 16
rs 9.4285
cc 3
eloc 10
nc 4
nop 2
1
<?php
2
3
/**
4
 * Icon view helper.
5
 *
6
 * Can be used for Gltphicon and FontAwesome
7
 *
8
 * @author     Leandro Silva <[email protected]>
9
 *
10
 * @category   LosUi
11
 *
12
 * @license    https://github.com/Lansoweb/LosUi/blob/master/LICENSE MIT License
13
 *
14
 * @link       http://github.com/LansoWeb/LosUi
15
 * @link       http://fontawesome.io
16
 * @link       http://getbootstrap.com/components/#glyphicons
17
 */
18
namespace LosUi\View\Helper;
19
20
/**
21
 * Icon view helper.
22
 *
23
 * Can be used for Gltphicon and FontAwesome
24
 *
25
 * @author     Leandro Silva <[email protected]>
26
 *
27
 * @category   LosUi
28
 *
29
 * @license    https://github.com/Lansoweb/LosUi/blob/master/LICENSE MIT License
30
 *
31
 * @link       http://github.com/LansoWeb/LosUi
32
 * @link       http://fontawesome.io
33
 * @link       http://getbootstrap.com/components/#glyphicons
34
 */
35
class Icon
36
{
37
    protected $format = '<span class="%s"%s></span>';
38
    protected $formatI = '<i class="%s"%s></i>';
39
40
    public function __invoke($icon = null, $style = '')
41
    {
42
        if ($icon) {
43
            return $this->render($icon, $style);
44
        }
45
46
        return $this;
47
    }
48
49
    public function render($icon, $style = null)
50
    {
51
        if (substr($icon, 0, 3) == 'fa-') {
52
            $class = trim('fa '.$icon);
53
            $format = $this->formatI;
54
        } else {
55
            $class = trim('glyphicon '.$icon);
56
            $format = $this->format;
57
        }
58
59
        if (! empty($style)) {
60
            $style = ' style="'.$style.'"';
61
        }
62
63
        return sprintf($format, $class, $style);
64
    }
65
}
66