Passed
Pull Request — master (#258)
by
unknown
05:44 queued 01:05
created

getVariables()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 314
Code Lines 223

Duplication

Lines 0
Ratio 0 %

Importance

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