Passed
Pull Request — master (#258)
by
unknown
04:48
created

getVariables()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 322
Code Lines 228

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 228
dl 0
loc 322
rs 8
c 0
b 0
f 0
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' => __('Body Font', 'flynt'),
20
                    'name' => 'body-font',
21
                    'type' => 'flynt-typography',
22
                    'fallback' => 'Helvetica, Arial',
23
                    'default' => [
24
                        'family' => 'Roboto',
25
                        'variants' => ['400', '400italic', '500', '500italic', '700', '700italic'],
26
                        'category' => 'sans-serif',
27
                        'subsets' => ['latin-ext']
28
                    ],
29
                ],
30
                [
31
                    'label' => __('Heading Font', 'flynt'),
32
                    'name' => 'heading-font',
33
                    'type' => 'flynt-typography',
34
                    'fallback' => 'Helvetica, Arial',
35
                    'default' => [
36
                        'family' => 'Encode Sans Semi Condensed',
37
                        'variants' => ['700', '800'],
38
                        'category' => 'sans-serif',
39
                        'subsets' => ['latin-ext']
40
                    ],
41
                ],
42
            ],
43
        ],
44
        [
45
            'label' => __('Sizes', 'flynt'),
46
            'name' => 'sizes',
47
            'type' => 'section',
48
            'priority' => 160,
49
            'fields' => [
50
                [
51
                    'label' => __('Container Max Width', 'flynt'),
52
                    'name' => 'container-max-width',
53
                    'type' => 'flynt-range',
54
                    'default' => 1440,
55
                    'unit' => 'px',
56
                    'input_attrs' => [
57
                        'min' => 700,
58
                        'max' => 1600,
59
                        'step' => 1,
60
                    ],
61
                ],
62
                [
63
                    'label' => __('Container Padding Desktop', 'flynt'),
64
                    'name' => 'container-padding-desktop',
65
                    'type' => 'flynt-range',
66
                    'default' => 64,
67
                    'unit' => 'px',
68
                    'input_attrs' => [
69
                        'min' => 0,
70
                        'max' => 240,
71
                        'step' => 1,
72
                    ],
73
                ],
74
                [
75
                    'label' => __('Container Padding Tablet', 'flynt'),
76
                    'name' => 'container-padding-tablet',
77
                    'type' => 'flynt-range',
78
                    'default' => 32,
79
                    'unit' => 'px',
80
                    'input_attrs' => [
81
                        'min' => 0,
82
                        'max' => 64,
83
                        'step' => 1,
84
                    ],
85
                ],
86
                [
87
                    'label' => __('Container Padding Mobile', 'flynt'),
88
                    'name' => 'container-padding-mobile',
89
                    'type' => 'flynt-range',
90
                    'default' => 16,
91
                    'unit' => 'px',
92
                    'input_attrs' => [
93
                        'min' => 0,
94
                        'max' => 32,
95
                        'step' => 1,
96
                    ],
97
                ],
98
                [
99
                    'label' => __('Content Max Width', 'flynt'),
100
                    'name' => 'content-max-width',
101
                    'type' => 'flynt-range',
102
                    'default' => 690,
103
                    'unit' => 'px',
104
                    'input_attrs' => [
105
                        'min' => 0,
106
                        'max' => 1440,
107
                        'step' => 1,
108
                    ],
109
                ],
110
                [
111
                    'label' => __('Content Max Width Large', 'flynt'),
112
                    'name' => 'content-max-width-large',
113
                    'type' => 'flynt-range',
114
                    'default' => 860,
115
                    'unit' => 'px',
116
                    'input_attrs' => [
117
                        'min' => 0,
118
                        'max' => 1440,
119
                        'step' => 1,
120
                    ],
121
                ],
122
                [
123
                    'label' => __('Component Spacing', 'flynt'),
124
                    'name' => 'component-spacing-base',
125
                    'type' => 'flynt-range',
126
                    'default' => 48,
127
                    'unit' => 'px',
128
                    'input_attrs' => [
129
                        'min' => 0,
130
                        'max' => 96,
131
                        'step' => 1,
132
                    ],
133
                ],
134
                [
135
                    'label' => __('Gutter Width', 'flynt'),
136
                    'name' => 'gutter-width',
137
                    'type' => 'flynt-range',
138
                    'default' => 24,
139
                    'unit' => 'px',
140
                    'input_attrs' => [
141
                        'min' => 0,
142
                        'max' => 48,
143
                        'step' => 4,
144
                    ],
145
                ],
146
                [
147
                    'label' => __('Box Spacing', 'flynt'),
148
                    'name' => 'box-spacing',
149
                    'type' => 'flynt-range',
150
                    'default' => 32,
151
                    'unit' => 'px',
152
                    'input_attrs' => [
153
                        'min' => 16,
154
                        'max' => 48,
155
                        'step' => 4,
156
                    ],
157
                ],
158
                [
159
                    'label' => __('Box Border Radius', 'flynt'),
160
                    'name' => 'box-border-radius',
161
                    'type' => 'flynt-range',
162
                    'default' => 16,
163
                    'unit' => 'px',
164
                    'input_attrs' => [
165
                        'min' => 0,
166
                        'max' => 32,
167
                        'step' => 1,
168
                    ],
169
                ],
170
            ]
171
        ],
172
        [
173
            'label' => __('Colors', 'flynt'),
174
            'name' => 'colors',
175
            'type' => 'panel',
176
            'priority' => 161,
177
            'sections' => [
178
                [
179
                    'label' => __('Default', 'flynt'),
180
                    'name' => 'default',
181
                    'type' => 'section',
182
                    'fields' => [
183
                        [
184
                            'label' => __('Accent', 'flynt'),
185
                            'name' => 'theme-default-color-accent',
186
                            'type' => 'color',
187
                            'default' => '#2b44df',
188
                            'hsl' => 1,
189
                        ],
190
                        [
191
                            'label' => __('Headline', 'flynt'),
192
                            'name' => 'theme-default-color-headline',
193
                            'type' => 'color',
194
                            'default' => '#252525',
195
                        ],
196
                        [
197
                            'label' => __('Text', 'flynt'),
198
                            'name' => 'theme-default-color-text',
199
                            'type' => 'color',
200
                            'default' => '#353535',
201
                        ],
202
                        [
203
                            'label' => __('Border', 'flynt'),
204
                            'name' => 'theme-default-color-border',
205
                            'type' => 'color',
206
                            'default' => '#8791BA',
207
                            'hsl' => 1,
208
                        ],
209
                        [
210
                            'label' => __('Background', 'flynt'),
211
                            'name' => 'theme-default-color-background',
212
                            'type' => 'color',
213
                            'default' => '#ffffff',
214
                        ],
215
                    ]
216
                ],
217
                [
218
                    'label' => __('Theme Light', 'flynt'),
219
                    'name' => 'light',
220
                    'type' => 'section',
221
                    'fields' => [
222
                        [
223
                            'label' => __('Accent', 'flynt'),
224
                            'name' => 'theme-light-color-accent',
225
                            'type' => 'color',
226
                            'default' => '#2b44df',
227
                            'hsl' => 1,
228
                        ],
229
                        [
230
                            'label' => __('Headline', 'flynt'),
231
                            'name' => 'theme-light-color-headline',
232
                            'type' => 'color',
233
                            'default' => '#252525',
234
                        ],
235
                        [
236
                            'label' => __('Text', 'flynt'),
237
                            'name' => 'theme-light-color-text',
238
                            'type' => 'color',
239
                            'default' => '#353535',
240
                        ],
241
                        [
242
                            'label' => __('Border', 'flynt'),
243
                            'name' => 'theme-light-color-border',
244
                            'type' => 'color',
245
                            'default' => '#8791BA',
246
                            'hsl' => 1,
247
                        ],
248
                        [
249
                            'label' => __('Background', 'flynt'),
250
                            'name' => 'theme-light-color-background',
251
                            'type' => 'color',
252
                            'default' => '#F8F9FD',
253
                        ],
254
                    ]
255
                ],
256
                [
257
                    'label' => __('Theme Dark', 'flynt'),
258
                    'name' => 'dark',
259
                    'type' => 'section',
260
                    'fields' => [
261
                        [
262
                            'label' => __('Accent', 'flynt'),
263
                            'name' => 'theme-dark-color-accent',
264
                            'type' => 'color',
265
                            'default' => '#ffc261',
266
                            'hsl' => 1,
267
                        ],
268
                        [
269
                            'label' => __('Headline', 'flynt'),
270
                            'name' => 'theme-dark-color-headline',
271
                            'type' => 'color',
272
                            'default' => '#FBFBFB',
273
                        ],
274
                        [
275
                            'label' => __('Text', 'flynt'),
276
                            'name' => 'theme-dark-color-text',
277
                            'type' => 'color',
278
                            'default' => '#E9E9EC',
279
                        ],
280
                        [
281
                            'label' => __('Border', 'flynt'),
282
                            'name' => 'theme-dark-color-border',
283
                            'type' => 'color',
284
                            'default' => '#C3C4F7',
285
                            'hsl' => 1,
286
                        ],
287
                        [
288
                            'label' => __('Background', 'flynt'),
289
                            'name' => 'theme-dark-color-background',
290
                            'type' => 'color',
291
                            'default' => '#10205A',
292
                        ],
293
                    ]
294
                ],
295
                [
296
                    'label' => __('Theme Hero', 'flynt'),
297
                    'name' => 'hero',
298
                    'type' => 'section',
299
                    'fields' => [
300
                        [
301
                            'label' => __('Accent', 'flynt'),
302
                            'name' => 'theme-hero-color-accent',
303
                            'type' => 'color',
304
                            'default' => '#ffc261',
305
                            'hsl' => 1,
306
                        ],
307
                        [
308
                            'label' => __('Headline', 'flynt'),
309
                            'name' => 'theme-hero-color-headline',
310
                            'type' => 'color',
311
                            'default' => '#FBFBFB',
312
                        ],
313
                        [
314
                            'label' => __('Text', 'flynt'),
315
                            'name' => 'theme-hero-color-text',
316
                            'type' => 'color',
317
                            'default' => '#E9E9EC',
318
                        ],
319
                        [
320
                            'label' => __('Border', 'flynt'),
321
                            'name' => 'theme-hero-color-border',
322
                            'type' => 'color',
323
                            'default' => '#CDE2FD',
324
                            'hsl' => 1,
325
                        ],
326
                        [
327
                            'label' => __('Background', 'flynt'),
328
                            'name' => 'theme-hero-color-background',
329
                            'type' => 'color',
330
                            'default' => '#2B44DF',
331
                        ],
332
                    ]
333
                ],
334
            ]
335
        ]
336
    ];
337
}
338