| Conditions | 1 |
| Paths | 1 |
| Total Lines | 129 |
| Code Lines | 99 |
| 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_preset' => [ |
||
| 38 | 'label' => esc_html_x('Style', 'admin-text', 'site-reviews'), |
||
| 39 | 'label_block' => false, |
||
| 40 | 'options' => [ |
||
| 41 | '1' => esc_html_x('Style 1', 'admin-text', 'site-reviews'), |
||
| 42 | '2' => esc_html_x('Style 2', 'admin-text', 'site-reviews'), |
||
| 43 | '3' => esc_html_x('Style 3', 'admin-text', 'site-reviews'), |
||
| 44 | ], |
||
| 45 | 'placeholder' => esc_html_x('Default', 'admin-text', 'site-reviews'), |
||
| 46 | 'prefix_class' => 'is-style-', |
||
| 47 | 'type' => Controls_Manager::SELECT, |
||
| 48 | ], |
||
| 49 | 'style_align' => [ |
||
| 50 | 'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'), |
||
| 51 | 'label_block' => false, |
||
| 52 | 'default' => 'left', |
||
| 53 | 'options' => [ |
||
| 54 | 'left' => [ |
||
| 55 | 'icon' => 'eicon-flex eicon-align-start-h', |
||
| 56 | 'title' => esc_html_x('Start', 'admin-text', 'site-reviews'), |
||
| 57 | ], |
||
| 58 | 'center' => [ |
||
| 59 | 'icon' => 'eicon-flex eicon-align-center-h', |
||
| 60 | 'title' => esc_html_x('Center', 'admin-text', 'site-reviews'), |
||
| 61 | ], |
||
| 62 | 'right' => [ |
||
| 63 | 'icon' => 'eicon-flex eicon-align-end-h', |
||
| 64 | 'title' => esc_html_x('End', 'admin-text', 'site-reviews'), |
||
| 65 | ], |
||
| 66 | ], |
||
| 67 | 'prefix_class' => 'items-justified-', |
||
| 68 | 'selectors' => [ |
||
| 69 | '{{WRAPPER}} .glsr-summary-text' => 'text-align: {{VALUE}};', |
||
| 70 | ], |
||
| 71 | 'type' => Controls_Manager::CHOOSE, |
||
| 72 | ], |
||
| 73 | 'style_max_width' => [ |
||
| 74 | 'default' => [ |
||
| 75 | 'unit' => '%', |
||
| 76 | ], |
||
| 77 | 'is_responsive' => true, |
||
| 78 | 'label' => esc_html_x('Max Width', 'admin-text', 'site-reviews'), |
||
| 79 | 'selectors' => [ |
||
| 80 | '{{WRAPPER}}' => '--glsr-max-w: {{SIZE}}{{UNIT}};', |
||
| 81 | ], |
||
| 82 | 'size_units' => ['%', 'px', 'em', 'rem', 'custom'], |
||
| 83 | 'type' => Controls_Manager::SLIDER, |
||
| 84 | ], |
||
| 85 | 'style_rating_separator' => [ |
||
| 86 | 'label' => esc_html_x('Rating', 'admin-text', 'site-reviews'), |
||
| 87 | 'separator' => 'before', |
||
| 88 | 'type' => Controls_Manager::HEADING, |
||
| 89 | ], |
||
| 90 | 'style_rating_color' => [ |
||
| 91 | 'global' => [ |
||
| 92 | 'default' => '', |
||
| 93 | ], |
||
| 94 | 'label' => esc_html_x('Star Color', 'admin-text', 'site-reviews'), |
||
| 95 | 'label_block' => false, |
||
| 96 | 'selectors' => [ |
||
| 97 | '{{WRAPPER}} .glsr:not([data-theme])' => '--glsr-summary-star-bg: {{VALUE}}', |
||
| 98 | ], |
||
| 99 | 'type' => Controls_Manager::COLOR, |
||
| 100 | ], |
||
| 101 | 'style_rating_size' => [ |
||
| 102 | 'is_responsive' => true, |
||
| 103 | 'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
||
| 104 | 'selectors' => [ |
||
| 105 | '{{WRAPPER}}' => '--glsr-summary-star: {{SIZE}}{{UNIT}};', |
||
| 106 | ], |
||
| 107 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
| 108 | 'type' => Controls_Manager::SLIDER, |
||
| 109 | ], |
||
| 110 | 'style_rating_typography' => [ |
||
| 111 | 'label' => esc_html_x('Typography', 'admin-text', 'site-reviews'), |
||
| 112 | 'selector' => '{{WRAPPER}} .glsr-summary-rating', |
||
| 113 | 'type' => Group_Control_Typography::get_type(), |
||
| 114 | ], |
||
| 115 | 'style_text_separator' => [ |
||
| 116 | 'label' => esc_html_x('Text', 'admin-text', 'site-reviews'), |
||
| 117 | 'separator' => 'before', |
||
| 118 | 'type' => Controls_Manager::HEADING, |
||
| 119 | ], |
||
| 120 | 'style_text_typography' => [ |
||
| 121 | 'type' => 'typography', |
||
| 122 | 'label' => esc_html_x('Typography', 'admin-text', 'site-reviews'), |
||
| 123 | 'selector' => '{{WRAPPER}} .glsr-summary-text', |
||
| 124 | ], |
||
| 125 | 'style_bar_separator' => [ |
||
| 126 | 'label' => esc_html_x('Bars', 'admin-text', 'site-reviews'), |
||
| 127 | 'separator' => 'before', |
||
| 128 | 'type' => Controls_Manager::HEADING, |
||
| 129 | ], |
||
| 130 | 'style_bar_color' => [ |
||
| 131 | 'global' => [ |
||
| 132 | 'default' => '', |
||
| 133 | ], |
||
| 134 | 'label' => esc_html_x('Color', 'admin-text', 'site-reviews'), |
||
| 135 | 'label_block' => false, |
||
| 136 | 'selectors' => [ |
||
| 137 | '{{WRAPPER}}' => '--glsr-bar-bg: {{VALUE}}', |
||
| 138 | ], |
||
| 139 | 'type' => Controls_Manager::COLOR, |
||
| 140 | ], |
||
| 141 | 'style_bar_gap' => [ |
||
| 142 | 'is_responsive' => true, |
||
| 143 | 'label' => esc_html_x('Gap', 'admin-text', 'site-reviews'), |
||
| 144 | 'selectors' => [ |
||
| 145 | '{{WRAPPER}}' => '--glsr-bar-spacing: {{SIZE}}{{UNIT}};', |
||
| 146 | ], |
||
| 147 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
| 148 | 'type' => Controls_Manager::SLIDER, |
||
| 149 | ], |
||
| 150 | 'style_bar_size' => [ |
||
| 151 | 'is_responsive' => true, |
||
| 152 | 'label' => esc_html_x('Percent Bar Height', 'admin-text', 'site-reviews'), |
||
| 153 | 'selectors' => [ |
||
| 154 | '{{WRAPPER}}' => '--glsr-bar-size: {{SIZE}}{{UNIT}};', |
||
| 155 | ], |
||
| 156 | 'size_units' => ['px', 'em', 'rem', 'custom'], |
||
| 157 | 'type' => Controls_Manager::SLIDER, |
||
| 158 | ], |
||
| 159 | 'style_bar_typography' => [ |
||
| 160 | 'label' => esc_html_x('Typography', 'admin-text', 'site-reviews'), |
||
| 161 | 'selector' => '{{WRAPPER}} .glsr-summary-percentages', |
||
| 162 | 'type' => Group_Control_Typography::get_type(), |
||
| 163 | ], |
||
| 167 |