Completed
Push — master ( f6fba0...ba06bd )
by WEBEWEB
02:23
created

MaterialDesignIconicFontIconRenderer   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 16
lcom 0
cbo 2
dl 0
loc 83
c 0
b 0
f 0
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A renderBorder() 0 3 2
A renderFixedWidth() 0 3 2
A renderFlip() 0 3 2
A renderName() 0 3 2
A renderPull() 0 3 2
A renderRotate() 0 3 2
A renderSize() 0 3 2
A renderSpin() 0 3 2
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\MaterialDesignIconicFont;
13
14
use WBW\Bundle\CoreBundle\Icon\IconRenderer;
15
16
/**
17
 * Material Design Iconic Font icon renderer.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\CoreBundle\Icon\MaterialDesignIconicFont
21
 */
22
class MaterialDesignIconicFontIconRenderer extends IconRenderer {
23
24
    /**
25
     * Render a border.
26
     *
27
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
28
     * @return string|null Returns the rendered border in case of success, null otherwise.
29
     */
30
    public static function renderBorder(MaterialDesignIconicFontIconInterface $icon) {
31
        return null !== $icon->getBorder() ? "zmdi-hc-" . $icon->getBorder() : null;
32
    }
33
34
    /**
35
     * Render a fixed width.
36
     *
37
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
38
     * @return string Returns the rendered fixed width in case of success, null otherwise.
39
     */
40
    public static function renderFixedWidth(MaterialDesignIconicFontIconInterface $icon) {
41
        return true === $icon->getFixedWidth() ? "zmdi-hc-fw" : null;
42
    }
43
44
    /**
45
     * Render a flip.
46
     *
47
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
48
     * @return string|null Returns the rendered flip.
49
     */
50
    public static function renderFlip(MaterialDesignIconicFontIconInterface $icon) {
51
        return null !== $icon->getFlip() ? "zmdi-hc-flip-" . $icon->getFlip() : null;
52
    }
53
54
    /**
55
     * Render a name.
56
     *
57
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
58
     * @return string|null Returns the rendered name in case of success, false otherwise.
59
     */
60
    public static function renderName(MaterialDesignIconicFontIconInterface $icon) {
61
        return null !== $icon->getName() ? "zmdi-" . $icon->getName() : null;
62
    }
63
64
    /**
65
     * Render a pull.
66
     *
67
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
68
     * @return string|null Returns the rendered pull in case of success, null otherwise.
69
     */
70
    public static function renderPull(MaterialDesignIconicFontIconInterface $icon) {
71
        return null !== $icon->getPull() ? "pull-" . $icon->getPull() : null;
72
    }
73
74
    /**
75
     * Render a rotate.
76
     *
77
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
78
     * @return string|null Returns the rendered rotate in case of success, null otherwise.
79
     */
80
    public static function renderRotate(MaterialDesignIconicFontIconInterface $icon) {
81
        return null !== $icon->getRotate() ? "zmdi-hc-rotate-" . $icon->getRotate() : null;
82
    }
83
84
    /**
85
     * Render a size.
86
     *
87
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
88
     * @return string|null Returns the rendered size in case of success, null otherwise.
89
     */
90
    public static function renderSize(MaterialDesignIconicFontIconInterface $icon) {
91
        return null !== $icon->getSize() ? "zmdi-hc-" . $icon->getSize() : null;
92
    }
93
94
    /**
95
     * Render a spin.
96
     *
97
     * @param MaterialDesignIconicFontIconInterface $icon The icon.
98
     * @return string|null Returns the rendered spin in case of success, null otherwise.
99
     */
100
    public static function renderSpin(MaterialDesignIconicFontIconInterface $icon) {
101
        return null !== $icon->getSpin() ? "zmdi-hc-" . $icon->getSpin() : null;
102
    }
103
104
}
105