Conditions | 1 |
Paths | 1 |
Total Lines | 52 |
Code Lines | 39 |
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 |
||
35 | protected function styleConfig(): array |
||
36 | { |
||
37 | return [ |
||
38 | 'style_align' => [ |
||
39 | 'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'), |
||
40 | 'label_block' => false, |
||
41 | 'default' => 'left', |
||
42 | 'options' => [ |
||
43 | 'left' => [ |
||
44 | 'icon' => 'eicon-flex eicon-align-start-h', |
||
45 | 'title' => esc_html_x('Start', 'admin-text', 'site-reviews'), |
||
46 | ], |
||
47 | 'center' => [ |
||
48 | 'icon' => 'eicon-flex eicon-align-center-h', |
||
49 | 'title' => esc_html_x('Center', 'admin-text', 'site-reviews'), |
||
50 | ], |
||
51 | 'right' => [ |
||
52 | 'icon' => 'eicon-flex eicon-align-end-h', |
||
53 | 'title' => esc_html_x('End', 'admin-text', 'site-reviews'), |
||
54 | ], |
||
55 | ], |
||
56 | 'prefix_class' => 'items-justified-', |
||
57 | 'selectors' => [ |
||
58 | '{{WRAPPER}} .glsr-summary-text' => 'text-align: {{VALUE}};', |
||
59 | ], |
||
60 | 'type' => Controls_Manager::CHOOSE, |
||
61 | ], |
||
62 | 'style_heading' => [ |
||
63 | 'label' => esc_html_x('Heading', 'admin-text', 'site-reviews'), |
||
64 | 'selector' => '{{WRAPPER}} .glsr:not([data-theme]) h2, {{WRAPPER}} .glsr:not([data-theme]) h3, {{WRAPPER}} .glsr:not([data-theme]) h4', |
||
65 | 'type' => Group_Control_Typography::get_type(), |
||
66 | ], |
||
67 | 'style_text' => [ |
||
68 | 'label' => esc_html_x('Text', 'admin-text', 'site-reviews'), |
||
69 | 'selector' => '{{WRAPPER}} .glsr:not([data-theme])', |
||
70 | 'type' => Group_Control_Typography::get_type(), |
||
71 | ], |
||
72 | 'style_rating_size' => [ |
||
73 | 'is_responsive' => true, |
||
74 | 'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
||
75 | 'selectors' => [ |
||
76 | '{{WRAPPER}}' => '--glsr-review-star: {{SIZE}}{{UNIT}};', |
||
77 | ], |
||
78 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
79 | 'type' => Controls_Manager::SLIDER, |
||
80 | ], |
||
81 | 'style_rating_color' => [ |
||
82 | 'label' => esc_html_x('Star Color', 'admin-text', 'site-reviews'), |
||
83 | 'selectors' => [ |
||
84 | '{{WRAPPER}} .glsr:not([data-theme])' => '--glsr-review-star-bg: {{VALUE}};', |
||
85 | ], |
||
86 | 'type' => Controls_Manager::COLOR, |
||
87 | ], |
||
91 |