| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 56 | 
| Code Lines | 45 | 
| 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 | ||
| 19 | public static function vcShortcodeSettings(): array | ||
| 20 |     { | ||
| 21 | return [ | ||
| 22 | 'assigned_posts' => [ | ||
| 23 | 'type' => 'autocomplete', | ||
| 24 |                 'heading' => esc_html_x('Assign New Reviews to Pages', 'admin-text', 'site-reviews'), | ||
| 25 | 'param_name' => 'assigned_posts', | ||
| 26 | 'settings' => [ | ||
| 27 | 'multiple' => true, | ||
| 28 | 'sortable' => true, | ||
| 29 | ], | ||
| 30 | ], | ||
| 31 | 'assigned_terms' => [ | ||
| 32 | 'type' => 'autocomplete', | ||
| 33 |                 'heading' => esc_html_x('Assign New Reviews to Categories', 'admin-text', 'site-reviews'), | ||
| 34 | 'param_name' => 'assigned_terms', | ||
| 35 | 'settings' => [ | ||
| 36 | 'multiple' => true, | ||
| 37 | 'sortable' => true, | ||
| 38 | ], | ||
| 39 | ], | ||
| 40 | 'assigned_users' => [ | ||
| 41 | 'type' => 'autocomplete', | ||
| 42 |                 'heading' => esc_html_x('Assign New Reviews to Users', 'admin-text', 'site-reviews'), | ||
| 43 | 'param_name' => 'assigned_users', | ||
| 44 | 'settings' => [ | ||
| 45 | 'multiple' => true, | ||
| 46 | 'sortable' => true, | ||
| 47 | ], | ||
| 48 | ], | ||
| 49 | 'hide' => [ | ||
| 50 | 'type' => 'checkbox', | ||
| 51 |                 'heading' => esc_html_x('Hide Options', 'admin-text', 'site-reviews'), | ||
| 52 | 'param_name' => 'hide', | ||
| 53 | 'value' => array_flip(static::vcShortcode()->getHideOptions()), | ||
| 54 | ], | ||
| 55 | 'reviews_id' => [ | ||
| 56 | 'type' => 'textfield', | ||
| 57 |                 'heading' => esc_html_x('Reviews ID', 'admin-text', 'site-reviews'), | ||
| 58 |                 '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'), | ||
| 59 | 'param_name' => 'reviews_id', | ||
| 60 |                 'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'), | ||
| 61 | ], | ||
| 62 | 'id' => [ | ||
| 63 | 'type' => 'textfield', | ||
| 64 |                 'heading' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'), | ||
| 65 |                 'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'), | ||
| 66 | 'param_name' => 'id', | ||
| 67 |                 'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'), | ||
| 68 | ], | ||
| 69 | 'class' => [ | ||
| 70 | 'type' => 'textfield', | ||
| 71 |                 'heading' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'), | ||
| 72 |                 'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'), | ||
| 73 | 'param_name' => 'class', | ||
| 74 |                 'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'), | ||
| 75 | ], | ||
| 79 |