| Conditions | 1 |
| Paths | 1 |
| Total Lines | 83 |
| Code Lines | 68 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 10 | public function options(): array |
||
| 11 | { |
||
| 12 | return [ |
||
| 13 | 'assignment_group' => [ |
||
| 14 | 'type' => 'group', |
||
| 15 | 'heading' => esc_html_x('Review Assignment', 'admin-text', 'site-reviews'), |
||
| 16 | 'options' => [ |
||
| 17 | 'assigned_posts' => [ |
||
| 18 | 'type' => 'select', |
||
| 19 | 'heading' => esc_html_x('Assign New Reviews to Pages', 'admin-text', 'site-reviews'), |
||
| 20 | 'default' => '', |
||
| 21 | 'full_width' => true, |
||
| 22 | 'config' => [ |
||
| 23 | 'multiple' => true, |
||
| 24 | 'placeholder' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
||
| 25 | 'postSelect' => 'assigned_posts_query', |
||
| 26 | ], |
||
| 27 | ], |
||
| 28 | 'assigned_terms' => [ |
||
| 29 | 'type' => 'select', |
||
| 30 | 'heading' => esc_html_x('Assign New Reviews to Categories', 'admin-text', 'site-reviews'), |
||
| 31 | 'default' => '', |
||
| 32 | 'full_width' => true, |
||
| 33 | 'config' => [ |
||
| 34 | 'multiple' => true, |
||
| 35 | 'placeholder' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
||
| 36 | 'termSelect' => [ |
||
| 37 | 'taxonomies' => glsr()->taxonomy, |
||
| 38 | ], |
||
| 39 | ], |
||
| 40 | ], |
||
| 41 | 'assigned_users' => [ |
||
| 42 | 'type' => 'select', |
||
| 43 | 'heading' => esc_html_x('Assign New Reviews to Users', 'admin-text', 'site-reviews'), |
||
| 44 | 'default' => '', |
||
| 45 | 'full_width' => true, |
||
| 46 | 'config' => [ |
||
| 47 | 'multiple' => true, |
||
| 48 | 'placeholder' => esc_html_x('Select...', 'admin-text', 'site-reviews'), |
||
| 49 | 'postSelect' => 'assigned_users_query', |
||
| 50 | ], |
||
| 51 | ], |
||
| 52 | ], |
||
| 53 | ], |
||
| 54 | 'hide_group' => [ |
||
| 55 | 'type' => 'group', |
||
| 56 | 'heading' => esc_html_x('Hide Fields', 'admin-text', 'site-reviews'), |
||
| 57 | 'options' => $this->hideOptions(), |
||
| 58 | ], |
||
| 59 | 'advanced_group' => [ |
||
| 60 | 'type' => 'group', |
||
| 61 | 'heading' => esc_html_x('Advanced', 'admin-text', 'site-reviews'), |
||
| 62 | 'options' => [ |
||
| 63 | 'id' => [ |
||
| 64 | 'type' => 'textfield', |
||
| 65 | 'heading' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'), |
||
| 66 | 'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'), |
||
| 67 | 'full_width' => true, |
||
| 68 | ], |
||
| 69 | 'reviews_id' => [ |
||
| 70 | 'type' => 'textfield', |
||
| 71 | 'heading' => esc_html_x('Custom Reviews ID', 'admin-text', 'site-reviews'), |
||
| 72 | 'description' => esc_html_x('Enter the Custom ID of a reviews block, shortcode, or widget where the review should be displayed after submission.', 'admin-text', 'site-reviews'), |
||
| 73 | 'full_width' => true, |
||
| 74 | ], |
||
| 75 | 'class' => [ |
||
| 76 | 'type' => 'textfield', |
||
| 77 | 'heading' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'), |
||
| 78 | 'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'), |
||
| 79 | 'full_width' => true, |
||
| 80 | ], |
||
| 81 | 'visibility' => [ |
||
| 82 | 'type' => 'select', |
||
| 83 | 'heading' => esc_html_x('Visibility', 'admin-text', 'site-reviews'), |
||
| 84 | 'default' => '', |
||
| 85 | 'options' => [ |
||
| 86 | '' => esc_html_x('Visible', 'admin-text', 'site-reviews'), |
||
| 87 | 'hidden' => esc_html_x('Hidden', 'admin-text', 'site-reviews'), |
||
| 88 | 'hide-for-medium' => esc_html_x('Only for Desktop', 'admin-text', 'site-reviews'), |
||
| 89 | 'show-for-small' => esc_html_x('Only for Mobile', 'admin-text', 'site-reviews'), |
||
| 90 | 'show-for-medium hide-for-small' => esc_html_x('Only for Tablet', 'admin-text', 'site-reviews'), |
||
| 91 | 'show-for-medium' => esc_html_x('Hide for Desktop', 'admin-text', 'site-reviews'), |
||
| 92 | 'hide-for-small' => esc_html_x('Hide for Mobile', 'admin-text', 'site-reviews'), |
||
| 93 | ], |
||
| 115 |