|
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\Assets\Icon; |
|
13
|
|
|
|
|
14
|
|
|
use WBW\Library\Symfony\Assets\AbstractIcon; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Material Design Iconic Font icon. |
|
18
|
|
|
* |
|
19
|
|
|
* @author webeweb <https://github.com/webeweb> |
|
20
|
|
|
* @package WBW\Bundle\CoreBundle\Assets\Icon |
|
21
|
|
|
*/ |
|
22
|
|
|
class MaterialDesignIconicFontIcon extends AbstractIcon implements MaterialDesignIconicFontIconInterface { |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Border. |
|
26
|
|
|
* |
|
27
|
|
|
* @var string|null |
|
28
|
|
|
*/ |
|
29
|
|
|
private $border; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Fixed width. |
|
33
|
|
|
* |
|
34
|
|
|
* @var bool|null |
|
35
|
|
|
*/ |
|
36
|
|
|
private $fixedWidth; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Flip. |
|
40
|
|
|
* |
|
41
|
|
|
* @var string|null |
|
42
|
|
|
*/ |
|
43
|
|
|
private $flip; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Pull. |
|
47
|
|
|
* |
|
48
|
|
|
* @var string|null |
|
49
|
|
|
*/ |
|
50
|
|
|
private $pull; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Rotate. |
|
54
|
|
|
* |
|
55
|
|
|
* @var string|null |
|
56
|
|
|
*/ |
|
57
|
|
|
private $rotate; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Size. |
|
61
|
|
|
* |
|
62
|
|
|
* @var string|null |
|
63
|
|
|
*/ |
|
64
|
|
|
private $size; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Spin. |
|
68
|
|
|
* |
|
69
|
|
|
* @var string|null |
|
70
|
|
|
*/ |
|
71
|
|
|
private $spin; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Constructor. |
|
75
|
|
|
*/ |
|
76
|
|
|
public function __construct() { |
|
77
|
|
|
parent::__construct(); |
|
78
|
|
|
|
|
79
|
|
|
$this->setFixedWidth(false); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Enumerate the borders. |
|
84
|
|
|
* |
|
85
|
|
|
* @return string[] Returns the borders enumeration. |
|
86
|
|
|
*/ |
|
87
|
|
|
public static function enumBorders(): array { |
|
88
|
|
|
|
|
89
|
|
|
return [ |
|
90
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_BORDER, |
|
91
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_BORDER_CIRCLE, |
|
92
|
|
|
]; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Enumerate the flips. |
|
97
|
|
|
* |
|
98
|
|
|
* @return string[] Returns the flips enumeration. |
|
99
|
|
|
*/ |
|
100
|
|
|
public static function enumFlips(): array { |
|
101
|
|
|
|
|
102
|
|
|
return [ |
|
103
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_FLIP_HORIZONTAL, |
|
104
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_FLIP_VERTICAL, |
|
105
|
|
|
]; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Enumerate the pulls. |
|
110
|
|
|
* |
|
111
|
|
|
* @return string[] Returns the pulls enumeration. |
|
112
|
|
|
*/ |
|
113
|
|
|
public static function enumPulls(): array { |
|
114
|
|
|
|
|
115
|
|
|
return [ |
|
116
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_PULL_LEFT, |
|
117
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_PULL_RIGHT, |
|
118
|
|
|
]; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Enumerate the rotates. |
|
123
|
|
|
* |
|
124
|
|
|
* @return string[] Returns the rotates enumeration. |
|
125
|
|
|
*/ |
|
126
|
|
|
public static function enumRotates(): array { |
|
127
|
|
|
|
|
128
|
|
|
return [ |
|
129
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_ROTATE_90, |
|
130
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_ROTATE_180, |
|
131
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_ROTATE_270, |
|
132
|
|
|
]; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Enumerate the sizes. |
|
137
|
|
|
* |
|
138
|
|
|
* @return string[] Returns the sizes enumeration. |
|
139
|
|
|
*/ |
|
140
|
|
|
public static function enumSizes(): array { |
|
141
|
|
|
|
|
142
|
|
|
return [ |
|
143
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SIZE_LG, |
|
144
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SIZE_2X, |
|
145
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SIZE_3X, |
|
146
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SIZE_4X, |
|
147
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SIZE_5X, |
|
148
|
|
|
]; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Enumerate the spins. |
|
153
|
|
|
* |
|
154
|
|
|
* @return string[] Returns the spins enumeration. |
|
155
|
|
|
*/ |
|
156
|
|
|
public static function enumSpins(): array { |
|
157
|
|
|
|
|
158
|
|
|
return [ |
|
159
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SPIN, |
|
160
|
|
|
self::MATERIAL_DESIGN_ICONIC_FONT_SPIN_REVERSE, |
|
161
|
|
|
]; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* {@inheritDoc} |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getBorder(): ?string { |
|
168
|
|
|
return $this->border; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* {@inheritDoc} |
|
173
|
|
|
*/ |
|
174
|
|
|
public function getFixedWidth(): ?bool { |
|
175
|
|
|
return $this->fixedWidth; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* {@inheritDoc} |
|
180
|
|
|
*/ |
|
181
|
|
|
public function getFlip(): ?string { |
|
182
|
|
|
return $this->flip; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* {@inheritDoc} |
|
187
|
|
|
*/ |
|
188
|
|
|
public function getPull(): ?string { |
|
189
|
|
|
return $this->pull; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* {@inheritDoc} |
|
194
|
|
|
*/ |
|
195
|
|
|
public function getRotate(): ?string { |
|
196
|
|
|
return $this->rotate; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* {@inheritDoc} |
|
201
|
|
|
*/ |
|
202
|
|
|
public function getSize(): ?string { |
|
203
|
|
|
return $this->size; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* {@inheritDoc} |
|
208
|
|
|
*/ |
|
209
|
|
|
public function getSpin(): ?string { |
|
210
|
|
|
return $this->spin; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* {@inheritDoc} |
|
215
|
|
|
*/ |
|
216
|
|
|
public function setBorder(?string $border): MaterialDesignIconicFontIconInterface { |
|
217
|
|
|
|
|
218
|
|
|
if (false === in_array($border, static::enumBorders())) { |
|
219
|
|
|
$border = null; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
$this->border = $border; |
|
223
|
|
|
return $this; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* {@inheritDoc} |
|
228
|
|
|
*/ |
|
229
|
|
|
public function setFixedWidth(?bool $fixedWidth): MaterialDesignIconicFontIconInterface { |
|
230
|
|
|
$this->fixedWidth = $fixedWidth; |
|
231
|
|
|
return $this; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
*{@inheritDoc} |
|
236
|
|
|
*/ |
|
237
|
|
|
public function setFlip(?string $flip): MaterialDesignIconicFontIconInterface { |
|
238
|
|
|
|
|
239
|
|
|
if (false === in_array($flip, static::enumFlips())) { |
|
240
|
|
|
$flip = null; |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
$this->flip = $flip; |
|
244
|
|
|
return $this; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* {@inheritDoc} |
|
249
|
|
|
*/ |
|
250
|
|
|
public function setPull(?string $pull): MaterialDesignIconicFontIconInterface { |
|
251
|
|
|
|
|
252
|
|
|
if (false === in_array($pull, static::enumPulls())) { |
|
253
|
|
|
$pull = null; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
$this->pull = $pull; |
|
257
|
|
|
return $this; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* {@inheritDoc} |
|
262
|
|
|
*/ |
|
263
|
|
|
public function setRotate(?string $rotate): MaterialDesignIconicFontIconInterface { |
|
264
|
|
|
|
|
265
|
|
|
if (false === in_array($rotate, static::enumRotates())) { |
|
266
|
|
|
$rotate = null; |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
$this->rotate = $rotate; |
|
270
|
|
|
return $this; |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
/** |
|
274
|
|
|
* {@inheritDoc} |
|
275
|
|
|
*/ |
|
276
|
|
|
public function setSize(?string $size): MaterialDesignIconicFontIconInterface { |
|
277
|
|
|
|
|
278
|
|
|
if (false === in_array($size, static::enumSizes())) { |
|
279
|
|
|
$size = null; |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
$this->size = $size; |
|
283
|
|
|
return $this; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* {@inheritDoc} |
|
288
|
|
|
*/ |
|
289
|
|
|
public function setSpin(?string $spin): MaterialDesignIconicFontIconInterface { |
|
290
|
|
|
|
|
291
|
|
|
if (false === in_array($spin, static::enumSpins())) { |
|
292
|
|
|
$spin = null; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
$this->spin = $spin; |
|
296
|
|
|
return $this; |
|
297
|
|
|
} |
|
298
|
|
|
} |
|
299
|
|
|
|