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