| Conditions | 1 |
| Paths | 1 |
| Total Lines | 124 |
| Code Lines | 93 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 20 | protected function styleConfig(): array |
||
| 21 | { |
||
| 22 | return [ |
||
| 23 | 'alignment' => [ |
||
| 24 | 'default' => 'start', |
||
| 25 | 'is_responsive' => true, |
||
| 26 | 'label' => esc_html_x('Alignment', 'admin-text', 'site-reviews'), |
||
| 27 | 'label_block' => false, |
||
| 28 | 'options' => [ |
||
| 29 | 'start' => [ |
||
| 30 | 'title' => esc_html_x('Start', 'admin-text', 'site-reviews'), |
||
| 31 | 'icon' => 'eicon-flex eicon-align-start-h', |
||
| 32 | ], |
||
| 33 | 'center' => [ |
||
| 34 | 'title' => esc_html_x('Center', 'admin-text', 'site-reviews'), |
||
| 35 | 'icon' => 'eicon-flex eicon-align-center-h', |
||
| 36 | ], |
||
| 37 | 'end' => [ |
||
| 38 | 'title' => esc_html_x('End', 'admin-text', 'site-reviews'), |
||
| 39 | 'icon' => 'eicon-flex eicon-align-end-h', |
||
| 40 | ], |
||
| 41 | ], |
||
| 42 | 'selectors' => [ |
||
| 43 | '{{WRAPPER}} .glsr-summary' => 'justify-content: {{VALUE}};', |
||
| 44 | '{{WRAPPER}} .glsr-summary-text' => 'text-align: {{VALUE}};', |
||
| 45 | ], |
||
| 46 | 'type' => Controls_Manager::CHOOSE, |
||
| 47 | ], |
||
| 48 | 'max_width' => [ |
||
| 49 | 'default' => [ |
||
| 50 | 'unit' => 'px', |
||
| 51 | 'size' => 450, |
||
| 52 | ], |
||
| 53 | 'is_responsive' => true, |
||
| 54 | 'label' => esc_html_x('Max Width', 'admin-text', 'site-reviews'), |
||
| 55 | 'range' => [ |
||
| 56 | '%' => [ |
||
| 57 | 'min' => 50, |
||
| 58 | 'max' => 100, |
||
| 59 | ], |
||
| 60 | 'px' => [ |
||
| 61 | 'min' => 50, |
||
| 62 | 'max' => 1000, |
||
| 63 | ], |
||
| 64 | ], |
||
| 65 | 'selectors' => [ |
||
| 66 | '{{WRAPPER}}' => '--glsr-max-w: {{SIZE}}{{UNIT}};', |
||
| 67 | ], |
||
| 68 | 'size_units' => ['px', '%', 'custom'], |
||
| 69 | 'type' => Controls_Manager::SLIDER, |
||
| 70 | ], |
||
| 71 | 'percentage_bar_height' => [ |
||
| 72 | 'default' => [ |
||
| 73 | 'unit' => 'em', |
||
| 74 | 'size' => 1, |
||
| 75 | ], |
||
| 76 | 'is_responsive' => true, |
||
| 77 | 'label' => esc_html_x('Percent Bar Height', 'admin-text', 'site-reviews'), |
||
| 78 | 'range' => [ |
||
| 79 | 'em' => [ |
||
| 80 | 'max' => 1.5, |
||
| 81 | 'min' => 0.1, |
||
| 82 | 'step' => 0.1, |
||
| 83 | ], |
||
| 84 | ], |
||
| 85 | 'selectors' => [ |
||
| 86 | '{{WRAPPER}}' => '--glsr-bar-size: {{SIZE}}{{UNIT}};', |
||
| 87 | ], |
||
| 88 | 'size_units' => ['em', 'custom'], |
||
| 89 | 'type' => Controls_Manager::SLIDER, |
||
| 90 | ], |
||
| 91 | 'percentage_bar_spacing' => [ |
||
| 92 | 'default' => [ |
||
| 93 | 'size' => 1.5, |
||
| 94 | 'unit' => 'em', |
||
| 95 | ], |
||
| 96 | 'is_responsive' => true, |
||
| 97 | 'label' => esc_html_x('Percent Bar Spacing', 'admin-text', 'site-reviews'), |
||
| 98 | 'range' => [ |
||
| 99 | 'em' => [ |
||
| 100 | 'max' => 2, |
||
| 101 | 'min' => 1, |
||
| 102 | 'step' => 0.1, |
||
| 103 | ], |
||
| 104 | ], |
||
| 105 | 'selectors' => [ |
||
| 106 | '{{WRAPPER}}' => '--glsr-bar-spacing: {{SIZE}}{{UNIT}};', |
||
| 107 | ], |
||
| 108 | 'size_units' => ['em', 'custom'], |
||
| 109 | 'type' => Controls_Manager::SLIDER, |
||
| 110 | ], |
||
| 111 | 'rating_color' => [ |
||
| 112 | 'global' => [ |
||
| 113 | 'default' => '', |
||
| 114 | ], |
||
| 115 | 'label' => esc_html_x('Color', 'admin-text', 'site-reviews'), |
||
| 116 | 'label_block' => false, |
||
| 117 | 'selectors' => [ |
||
| 118 | '{{WRAPPER}} .glsr:not([data-theme]) .glsr-bar-background-percent' => '--glsr-bar-bg: {{VALUE}} !important', |
||
| 119 | '{{WRAPPER}} .glsr:not([data-theme]) .glsr-star-empty' => 'background: {{VALUE}} !important;', |
||
| 120 | '{{WRAPPER}} .glsr:not([data-theme]) .glsr-star-full' => 'background: {{VALUE}} !important;', |
||
| 121 | '{{WRAPPER}} .glsr:not([data-theme]) .glsr-star-half' => 'background: {{VALUE}} !important;', |
||
| 122 | ], |
||
| 123 | 'type' => Controls_Manager::COLOR, |
||
| 124 | ], |
||
| 125 | 'rating_size' => [ |
||
| 126 | 'default' => [ |
||
| 127 | 'unit' => 'em', |
||
| 128 | 'size' => 1.5, |
||
| 129 | ], |
||
| 130 | 'is_responsive' => true, |
||
| 131 | 'label' => esc_html_x('Star Size', 'admin-text', 'site-reviews'), |
||
| 132 | 'range' => [ |
||
| 133 | 'em' => [ |
||
| 134 | 'min' => 0.25, |
||
| 135 | 'max' => 2.25, |
||
| 136 | 'step' => 0.125, |
||
| 137 | ], |
||
| 138 | ], |
||
| 139 | 'selectors' => [ |
||
| 140 | '{{WRAPPER}}' => '--glsr-summary-star: {{SIZE}}{{UNIT}};', |
||
| 141 | ], |
||
| 142 | 'size_units' => ['em', 'custom'], |
||
| 143 | 'type' => Controls_Manager::SLIDER, |
||
| 144 | ], |
||
| 148 |