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