Completed
Push — master ( 74c910...b30669 )
by WEBEWEB
01:58
created

FontAwesomeIconRenderer::renderAnimation()   A

Complexity

Conditions 2
Paths 2

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 2
nc 2
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 {
21
22
    /**
23
     * Render an animation.
24
     *
25
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
26
     * @return string Returns the rendered animation in case of success, null otherwise.
27
     */
28
    public static function renderAnimation(FontAwesomeIconInterface $fontAwesomeIcon) {
29
        return null !== $fontAwesomeIcon->getAnimation() ? "fa-" . $fontAwesomeIcon->getAnimation() : null;
30
    }
31
32
    /**
33
     * Render a bordered.
34
     *
35
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
36
     * @return string Returns the rendered bordered in case of success, null otherwise.
37
     */
38
    public static function renderBordered(FontAwesomeIconInterface $fontAwesomeIcon) {
39
        return true === $fontAwesomeIcon->getBordered() ? "fa-border" : null;
40
    }
41
42
    /**
43
     * Render a fixed width.
44
     *
45
     * @param FontAwesomeIconInterface $fontAwesomeIcon 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 $fontAwesomeIcon) {
49
        return true === $fontAwesomeIcon->getFixedWidth() ? "fa-fw" : null;
50
    }
51
52
    /**
53
     * Render a font.
54
     *
55
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
56
     * @return string Returns the rendered font.
57
     */
58
    public static function renderFont(FontAwesomeIconInterface $fontAwesomeIcon) {
59
        return "fa" . $fontAwesomeIcon->getFont();
60
    }
61
62
    /**
63
     * Render a name.
64
     *
65
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
66
     * @return string Returns the rendered name in case of success, false otherwise.
67
     */
68
    public static function renderName(FontAwesomeIconInterface $fontAwesomeIcon) {
69
        return null !== $fontAwesomeIcon->getName() ? "fa-" . $fontAwesomeIcon->getName() : null;
70
    }
71
72
    /**
73
     * Render a pull.
74
     *
75
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
76
     * @return string Returns the rendered pull in case of success, null otherwise.
77
     */
78
    public static function renderPull(FontAwesomeIconInterface $fontAwesomeIcon) {
79
        return null !== $fontAwesomeIcon->getPull() ? "fa-pull-" . $fontAwesomeIcon->getPull() : null;
80
    }
81
82
    /**
83
     * Render a size.
84
     *
85
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
86
     * @return string Returns the rendered size in case of success, null otherwise.
87
     */
88
    public static function renderSize(FontAwesomeIconInterface $fontAwesomeIcon) {
89
        return null !== $fontAwesomeIcon->getSize() ? "fa-" . $fontAwesomeIcon->getSize() : null;
90
    }
91
92
    /**
93
     * Render a style.
94
     *
95
     * @param FontAwesomeIconInterface $fontAwesomeIcon The Font Awesome icon.
96
     * @return string Returns the rendered style.
97
     */
98
    public static function renderStyle(FontAwesomeIconInterface $fontAwesomeIcon) {
99
        return IconRenderer::renderStyle($fontAwesomeIcon);
100
    }
101
102
}
103