Passed
Pull Request — master (#258)
by Dominik
05:19
created

getVariables()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 406
Code Lines 291

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 291
c 0
b 0
f 0
dl 0
loc 406
rs 8
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * Define theme variables.
5
 */
6
7
namespace Flynt\Variables;
8
9
function getVariables()
10
{
11
    return [
12
        [
13
            'label' => __('Typography', 'flynt'),
14
            'name' => 'typo',
15
            'type' => 'section',
16
            'priority' => 160,
17
            'fields' => [
18
                [
19
                    'label' => __('Heading 1', 'flynt'),
20
                    'name' => 'h1-font',
21
                    'type' => 'flynt-typography',
22
                    'fallback' => 'Helvetica, Arial',
23
                    'italic' => 0,
24
                    'default' => [
25
                        'family' => 'Encode Sans Semi Condensed',
26
                        'category' => 'sans-serif',
27
                        'variant' => '800',
28
                    ],
29
                ],
30
                [
31
                    'label' => __('Heading 2', 'flynt'),
32
                    'name' => 'h2-font',
33
                    'type' => 'flynt-typography',
34
                    'fallback' => 'Helvetica, Arial',
35
                    'italic' => 0,
36
                    'default' => [
37
                        'family' => 'Encode Sans Semi Condensed',
38
                        'category' => 'sans-serif',
39
                        'variant' => '800',
40
                    ],
41
                ],
42
                [
43
                    'label' => __('Heading 3', 'flynt'),
44
                    'name' => 'h3-font',
45
                    'type' => 'flynt-typography',
46
                    'fallback' => 'Helvetica, Arial',
47
                    'italic' => 0,
48
                    'default' => [
49
                        'family' => 'Encode Sans Semi Condensed',
50
                        'category' => 'sans-serif',
51
                        'variant' => '700',
52
                    ],
53
                ],
54
                [
55
                    'label' => __('Heading 4', 'flynt'),
56
                    'name' => 'h4-font',
57
                    'type' => 'flynt-typography',
58
                    'fallback' => 'Helvetica, Arial',
59
                    'italic' => 0,
60
                    'default' => [
61
                        'family' => 'Encode Sans Semi Condensed',
62
                        'category' => 'sans-serif',
63
                        'variant' => '700',
64
                    ],
65
                ],
66
                [
67
                    'label' => __('Heading 5', 'flynt'),
68
                    'name' => 'h5-font',
69
                    'type' => 'flynt-typography',
70
                    'fallback' => 'Helvetica, Arial',
71
                    'italic' => 0,
72
                    'default' => [
73
                        'family' => 'Roboto',
74
                        'category' => 'sans-serif',
75
                        'variant' => '400',
76
                    ],
77
                ],
78
                [
79
                    'label' => __('Heading 6', 'flynt'),
80
                    'name' => 'h6-font',
81
                    'type' => 'flynt-typography',
82
                    'fallback' => 'Helvetica, Arial',
83
                    'italic' => 0,
84
                    'default' => [
85
                        'family' => 'Roboto',
86
                        'category' => 'sans-serif',
87
                        'variant' => '500',
88
                    ],
89
                ],
90
                [
91
                    'label' => __('Body Regular', 'flynt'),
92
                    'name' => 'body-regular-font',
93
                    'type' => 'flynt-typography',
94
                    'fallback' => 'Helvetica, Arial',
95
                    'italic' => 1,
96
                    'default' => [
97
                        'family' => 'Roboto',
98
                        'category' => 'sans-serif',
99
                        'variant' => '400',
100
                    ],
101
                ],
102
                [
103
                    'label' => __('Body Medium', 'flynt'),
104
                    'name' => 'body-medium-font',
105
                    'type' => 'flynt-typography',
106
                    'fallback' => 'Helvetica, Arial',
107
                    'italic' => 1,
108
                    'default' => [
109
                        'family' => 'Roboto',
110
                        'category' => 'sans-serif',
111
                        'variant' => '500',
112
                    ],
113
                ],
114
                [
115
                    'label' => __('Body Bold', 'flynt'),
116
                    'name' => 'body-bold-font',
117
                    'type' => 'flynt-typography',
118
                    'fallback' => 'Helvetica, Arial',
119
                    'italic' => 1,
120
                    'default' => [
121
                        'family' => 'Roboto',
122
                        'category' => 'sans-serif',
123
                        'variant' => '700',
124
                    ],
125
                ],
126
            ],
127
        ],
128
        [
129
            'label' => __('Sizes', 'flynt'),
130
            'name' => 'sizes',
131
            'type' => 'section',
132
            'priority' => 160,
133
            'fields' => [
134
                [
135
                    'label' => __('Container Max Width', 'flynt'),
136
                    'name' => 'container-max-width',
137
                    'type' => 'flynt-range',
138
                    'default' => 1440,
139
                    'unit' => 'px',
140
                    'input_attrs' => [
141
                        'min' => 700,
142
                        'max' => 1600,
143
                        'step' => 1,
144
                    ],
145
                ],
146
                [
147
                    'label' => __('Container Padding Desktop', 'flynt'),
148
                    'name' => 'container-padding-desktop',
149
                    'type' => 'flynt-range',
150
                    'default' => 64,
151
                    'unit' => 'px',
152
                    'input_attrs' => [
153
                        'min' => 0,
154
                        'max' => 240,
155
                        'step' => 1,
156
                    ],
157
                ],
158
                [
159
                    'label' => __('Container Padding Tablet', 'flynt'),
160
                    'name' => 'container-padding-tablet',
161
                    'type' => 'flynt-range',
162
                    'default' => 32,
163
                    'unit' => 'px',
164
                    'input_attrs' => [
165
                        'min' => 0,
166
                        'max' => 64,
167
                        'step' => 1,
168
                    ],
169
                ],
170
                [
171
                    'label' => __('Container Padding Mobile', 'flynt'),
172
                    'name' => 'container-padding-mobile',
173
                    'type' => 'flynt-range',
174
                    'default' => 16,
175
                    'unit' => 'px',
176
                    'input_attrs' => [
177
                        'min' => 0,
178
                        'max' => 32,
179
                        'step' => 1,
180
                    ],
181
                ],
182
                [
183
                    'label' => __('Content Max Width', 'flynt'),
184
                    'name' => 'content-max-width',
185
                    'type' => 'flynt-range',
186
                    'default' => 690,
187
                    'unit' => 'px',
188
                    'input_attrs' => [
189
                        'min' => 0,
190
                        'max' => 1440,
191
                        'step' => 1,
192
                    ],
193
                ],
194
                [
195
                    'label' => __('Content Max Width Large', 'flynt'),
196
                    'name' => 'content-max-width-large',
197
                    'type' => 'flynt-range',
198
                    'default' => 860,
199
                    'unit' => 'px',
200
                    'input_attrs' => [
201
                        'min' => 0,
202
                        'max' => 1440,
203
                        'step' => 1,
204
                    ],
205
                ],
206
                [
207
                    'label' => __('Component Spacing', 'flynt'),
208
                    'name' => 'component-spacing-base',
209
                    'type' => 'flynt-range',
210
                    'default' => 48,
211
                    'unit' => 'px',
212
                    'input_attrs' => [
213
                        'min' => 0,
214
                        'max' => 96,
215
                        'step' => 1,
216
                    ],
217
                ],
218
                [
219
                    'label' => __('Gutter Width', 'flynt'),
220
                    'name' => 'gutter-width',
221
                    'type' => 'flynt-range',
222
                    'default' => 24,
223
                    'unit' => 'px',
224
                    'input_attrs' => [
225
                        'min' => 0,
226
                        'max' => 48,
227
                        'step' => 4,
228
                    ],
229
                ],
230
                [
231
                    'label' => __('Box Spacing', 'flynt'),
232
                    'name' => 'box-spacing',
233
                    'type' => 'flynt-range',
234
                    'default' => 32,
235
                    'unit' => 'px',
236
                    'input_attrs' => [
237
                        'min' => 16,
238
                        'max' => 48,
239
                        'step' => 4,
240
                    ],
241
                ],
242
                [
243
                    'label' => __('Box Border Radius', 'flynt'),
244
                    'name' => 'box-border-radius',
245
                    'type' => 'flynt-range',
246
                    'default' => 16,
247
                    'unit' => 'px',
248
                    'input_attrs' => [
249
                        'min' => 0,
250
                        'max' => 32,
251
                        'step' => 1,
252
                    ],
253
                ],
254
            ]
255
        ],
256
        [
257
            'label' => __('Colors', 'flynt'),
258
            'name' => 'colors',
259
            'type' => 'panel',
260
            'priority' => 161,
261
            'sections' => [
262
                [
263
                    'label' => __('Default', 'flynt'),
264
                    'name' => 'default',
265
                    'type' => 'section',
266
                    'fields' => [
267
                        [
268
                            'label' => __('Accent', 'flynt'),
269
                            'name' => 'theme-default-color-accent',
270
                            'type' => 'color',
271
                            'default' => '#2b44df',
272
                            'hsl' => 1,
273
                        ],
274
                        [
275
                            'label' => __('Headline', 'flynt'),
276
                            'name' => 'theme-default-color-headline',
277
                            'type' => 'color',
278
                            'default' => '#252525',
279
                        ],
280
                        [
281
                            'label' => __('Text', 'flynt'),
282
                            'name' => 'theme-default-color-text',
283
                            'type' => 'color',
284
                            'default' => '#353535',
285
                        ],
286
                        [
287
                            'label' => __('Border', 'flynt'),
288
                            'name' => 'theme-default-color-border',
289
                            'type' => 'color',
290
                            'default' => '#8791BA',
291
                            'hsl' => 1,
292
                        ],
293
                        [
294
                            'label' => __('Background', 'flynt'),
295
                            'name' => 'theme-default-color-background',
296
                            'type' => 'color',
297
                            'default' => '#ffffff',
298
                        ],
299
                    ]
300
                ],
301
                [
302
                    'label' => __('Theme Light', 'flynt'),
303
                    'name' => 'light',
304
                    'type' => 'section',
305
                    'fields' => [
306
                        [
307
                            'label' => __('Accent', 'flynt'),
308
                            'name' => 'theme-light-color-accent',
309
                            'type' => 'color',
310
                            'default' => '#2b44df',
311
                            'hsl' => 1,
312
                        ],
313
                        [
314
                            'label' => __('Headline', 'flynt'),
315
                            'name' => 'theme-light-color-headline',
316
                            'type' => 'color',
317
                            'default' => '#252525',
318
                        ],
319
                        [
320
                            'label' => __('Text', 'flynt'),
321
                            'name' => 'theme-light-color-text',
322
                            'type' => 'color',
323
                            'default' => '#353535',
324
                        ],
325
                        [
326
                            'label' => __('Border', 'flynt'),
327
                            'name' => 'theme-light-color-border',
328
                            'type' => 'color',
329
                            'default' => '#8791BA',
330
                            'hsl' => 1,
331
                        ],
332
                        [
333
                            'label' => __('Background', 'flynt'),
334
                            'name' => 'theme-light-color-background',
335
                            'type' => 'color',
336
                            'default' => '#F8F9FD',
337
                        ],
338
                    ]
339
                ],
340
                [
341
                    'label' => __('Theme Dark', 'flynt'),
342
                    'name' => 'dark',
343
                    'type' => 'section',
344
                    'fields' => [
345
                        [
346
                            'label' => __('Accent', 'flynt'),
347
                            'name' => 'theme-dark-color-accent',
348
                            'type' => 'color',
349
                            'default' => '#ffc261',
350
                            'hsl' => 1,
351
                        ],
352
                        [
353
                            'label' => __('Headline', 'flynt'),
354
                            'name' => 'theme-dark-color-headline',
355
                            'type' => 'color',
356
                            'default' => '#FBFBFB',
357
                        ],
358
                        [
359
                            'label' => __('Text', 'flynt'),
360
                            'name' => 'theme-dark-color-text',
361
                            'type' => 'color',
362
                            'default' => '#E9E9EC',
363
                        ],
364
                        [
365
                            'label' => __('Border', 'flynt'),
366
                            'name' => 'theme-dark-color-border',
367
                            'type' => 'color',
368
                            'default' => '#C3C4F7',
369
                            'hsl' => 1,
370
                        ],
371
                        [
372
                            'label' => __('Background', 'flynt'),
373
                            'name' => 'theme-dark-color-background',
374
                            'type' => 'color',
375
                            'default' => '#10205A',
376
                        ],
377
                    ]
378
                ],
379
                [
380
                    'label' => __('Theme Hero', 'flynt'),
381
                    'name' => 'hero',
382
                    'type' => 'section',
383
                    'fields' => [
384
                        [
385
                            'label' => __('Accent', 'flynt'),
386
                            'name' => 'theme-hero-color-accent',
387
                            'type' => 'color',
388
                            'default' => '#ffc261',
389
                            'hsl' => 1,
390
                        ],
391
                        [
392
                            'label' => __('Headline', 'flynt'),
393
                            'name' => 'theme-hero-color-headline',
394
                            'type' => 'color',
395
                            'default' => '#FBFBFB',
396
                        ],
397
                        [
398
                            'label' => __('Text', 'flynt'),
399
                            'name' => 'theme-hero-color-text',
400
                            'type' => 'color',
401
                            'default' => '#E9E9EC',
402
                        ],
403
                        [
404
                            'label' => __('Border', 'flynt'),
405
                            'name' => 'theme-hero-color-border',
406
                            'type' => 'color',
407
                            'default' => '#CDE2FD',
408
                            'hsl' => 1,
409
                        ],
410
                        [
411
                            'label' => __('Background', 'flynt'),
412
                            'name' => 'theme-hero-color-background',
413
                            'type' => 'color',
414
                            'default' => '#2B44DF',
415
                        ],
416
                    ]
417
                ],
418
            ]
419
        ]
420
    ];
421
}
422