Completed
Push — master ( 4a40ab...6b6d29 )
by WEBEWEB
01:42
created

FontAwesomeIconRenderer::renderStyle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\Icon;
13
14
/**
15
 * Font Awesome icon renderer.
16
 *
17
 * @author webeweb <https://github.com/webeweb/>
18
 * @package WBW\Bundle\CoreBundle\Icon
19
 */
20
class FontAwesomeIconRenderer extends IconRenderer {
21
22
    /**
23
     * Render an animation.
24
     *
25
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
26
     * @return string Returns the rendered animation in case of success, null otherwise.
27
     */
28
    public static function renderAnimation(FontAwesomeIconInterface $icon) {
29
        return null !== $icon->getAnimation() ? "fa-" . $icon->getAnimation() : null;
30
    }
31
32
    /**
33
     * Render a bordered.
34
     *
35
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
36
     * @return string Returns the rendered bordered in case of success, null otherwise.
37
     */
38
    public static function renderBordered(FontAwesomeIconInterface $icon) {
39
        return true === $icon->getBordered() ? "fa-border" : null;
40
    }
41
42
    /**
43
     * Render a fixed width.
44
     *
45
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
46
     * @return string Returns the rendered fixed width in case of success, null otherwise.
47
     */
48
    public static function renderFixedWidth(FontAwesomeIconInterface $icon) {
49
        return true === $icon->getFixedWidth() ? "fa-fw" : null;
50
    }
51
52
    /**
53
     * Render a font.
54
     *
55
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
56
     * @return string Returns the rendered font.
57
     */
58
    public static function renderFont(FontAwesomeIconInterface $icon) {
59
        return "fa" . $icon->getFont();
60
    }
61
62
    /**
63
     * Render a name.
64
     *
65
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
66
     * @return string Returns the rendered name in case of success, false otherwise.
67
     */
68
    public static function renderName(FontAwesomeIconInterface $icon) {
69
        return null !== $icon->getName() ? "fa-" . $icon->getName() : null;
70
    }
71
72
    /**
73
     * Render a pull.
74
     *
75
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
76
     * @return string Returns the rendered pull in case of success, null otherwise.
77
     */
78
    public static function renderPull(FontAwesomeIconInterface $icon) {
79
        return null !== $icon->getPull() ? "fa-pull-" . $icon->getPull() : null;
80
    }
81
82
    /**
83
     * Render a size.
84
     *
85
     * @param FontAwesomeIconInterface $icon The Font Awesome icon.
86
     * @return string Returns the rendered size in case of success, null otherwise.
87
     */
88
    public static function renderSize(FontAwesomeIconInterface $icon) {
89
        return null !== $icon->getSize() ? "fa-" . $icon->getSize() : null;
90
    }
91
92
}
93