| Conditions | 1 |
| Paths | 1 |
| Total Lines | 61 |
| Code Lines | 47 |
| 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 |
||
| 37 | public function define_fields() { |
||
| 38 | |||
| 39 | return array( |
||
| 40 | array( |
||
| 41 | 'type' => 'container', |
||
| 42 | 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
||
| 43 | ), |
||
| 44 | array( |
||
| 45 | 'type' => 'listbox', |
||
| 46 | 'name' => 'columns', |
||
| 47 | 'label' => esc_attr__( 'Columns:', 'give' ), |
||
| 48 | 'tooltip' => esc_attr__( 'Sets the number of donations per row.', 'give' ), |
||
| 49 | 'options' => array( |
||
| 50 | '1' => esc_html__( '1', 'give' ), |
||
| 51 | '2' => esc_html__( '2', 'give' ), |
||
| 52 | '3' => esc_html__( '3', 'give' ), |
||
| 53 | '4' => esc_html__( '4', 'give' ), |
||
| 54 | ), |
||
| 55 | ), |
||
| 56 | array( |
||
| 57 | 'type' => 'listbox', |
||
| 58 | 'name' => 'show_goal', |
||
| 59 | 'label' => esc_attr__( 'Show Goal:', 'give' ), |
||
| 60 | 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
||
| 61 | 'options' => array( |
||
| 62 | 'true' => esc_html__( 'Show', 'give' ), |
||
| 63 | 'false' => esc_html__( 'Hide', 'give' ), |
||
| 64 | ), |
||
| 65 | ), |
||
| 66 | array( |
||
| 67 | 'type' => 'listbox', |
||
| 68 | 'name' => 'show_excerpt', |
||
| 69 | 'label' => esc_attr__( 'Show Excerpt:', 'give' ), |
||
| 70 | 'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ), |
||
| 71 | 'options' => array( |
||
| 72 | 'true' => esc_html__( 'Show', 'give' ), |
||
| 73 | 'false' => esc_html__( 'Hide', 'give' ), |
||
| 74 | ), |
||
| 75 | ), |
||
| 76 | array( |
||
| 77 | 'type' => 'listbox', |
||
| 78 | 'name' => 'show_featured_image', |
||
| 79 | 'label' => esc_attr__( 'Show Featured Image:', 'give' ), |
||
| 80 | 'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ), |
||
| 81 | 'options' => array( |
||
| 82 | 'true' => esc_html__( 'Show', 'give' ), |
||
| 83 | 'false' => esc_html__( 'Hide', 'give' ), |
||
| 84 | ), |
||
| 85 | ), |
||
| 86 | array( |
||
| 87 | 'type' => 'listbox', |
||
| 88 | 'name' => 'display_style', |
||
| 89 | 'label' => esc_attr__( 'Display Style:', 'give' ), |
||
| 90 | 'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ), |
||
| 91 | 'options' => array( |
||
| 92 | 'redirect' => esc_html__( 'Redirect', 'give' ), |
||
| 93 | 'modal_reveal' => esc_html__( 'Modal', 'give' ), |
||
| 94 | ), |
||
| 95 | ), |
||
| 96 | ); |
||
| 97 | } |
||
| 98 | } |
||
| 101 |