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