Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
Code Lines | 47 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
37 | protected function styleConfig(): array |
||
38 | { |
||
39 | return [ |
||
40 | 'style_col_gap' => [ |
||
41 | 'is_responsive' => true, |
||
42 | 'label' => esc_html_x('Column Gap', 'admin-text', 'site-reviews'), |
||
43 | 'selectors' => [ |
||
44 | '{{WRAPPER}}' => '--glsr-form-col-gap: {{SIZE}}{{UNIT}};', |
||
45 | ], |
||
46 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
47 | 'type' => Controls_Manager::SLIDER, |
||
48 | ], |
||
49 | 'style_row_gap' => [ |
||
50 | 'is_responsive' => true, |
||
51 | 'label' => esc_html_x('Row Gap', 'admin-text', 'site-reviews'), |
||
52 | 'selectors' => [ |
||
53 | '{{WRAPPER}}' => '--glsr-form-row-gap: {{SIZE}}{{UNIT}};', |
||
54 | ], |
||
55 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
56 | 'type' => Controls_Manager::SLIDER, |
||
57 | ], |
||
58 | 'style_rating_separator' => [ |
||
59 | 'label' => esc_html_x('Rating Field', 'admin-text', 'site-reviews'), |
||
60 | 'separator' => 'before', |
||
61 | 'type' => Controls_Manager::HEADING, |
||
62 | ], |
||
63 | 'style_rating_color' => [ |
||
64 | 'label' => esc_html_x('Star Color', 'admin-text', 'site-reviews'), |
||
65 | 'selectors' => [ |
||
66 | '{{WRAPPER}} .glsr:not([data-theme])' => '--glsr-form-star-bg: {{VALUE}};', |
||
67 | ], |
||
68 | 'type' => Controls_Manager::COLOR, |
||
69 | ], |
||
70 | 'style_rating_size' => [ |
||
71 | 'is_responsive' => true, |
||
72 | 'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
||
73 | 'selectors' => [ |
||
74 | '{{WRAPPER}}' => '--glsr-form-star: {{SIZE}}{{UNIT}};', |
||
75 | ], |
||
76 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
77 | 'type' => Controls_Manager::SLIDER, |
||
78 | ], |
||
79 | 'style_rating_gap' => [ |
||
80 | 'is_responsive' => true, |
||
81 | 'label' => esc_html_x('Star Spacing', 'admin-text', 'site-reviews'), |
||
82 | 'selectors' => [ |
||
83 | '{{WRAPPER}} .glsr-field-rating span[data-rating]' => 'column-gap: {{SIZE}}{{UNIT}};', |
||
84 | ], |
||
85 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
86 | 'type' => Controls_Manager::SLIDER, |
||
87 | ], |
||
88 | 'style_toggle_separator' => [ |
||
89 | 'label' => esc_html_x('Toggle Field', 'admin-text', 'site-reviews'), |
||
90 | 'separator' => 'before', |
||
91 | 'type' => Controls_Manager::HEADING, |
||
92 | ], |
||
93 | 'style_toggle_color' => [ |
||
94 | 'label' => esc_html_x('Toggle Color', 'admin-text', 'site-reviews'), |
||
95 | 'selectors' => [ |
||
96 | '{{WRAPPER}} .glsr-field-toggle' => '--glsr-toggle-bg-1: {{VALUE}};', |
||
97 | ], |
||
98 | 'type' => Controls_Manager::COLOR, |
||
99 | ], |
||
103 |