Conditions | 1 |
Paths | 1 |
Total Lines | 87 |
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 |
||
52 | public function settings( $cmb ) { |
||
53 | $cmb->add_field( |
||
54 | array( |
||
55 | 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
||
56 | 'id' => 'plan_filters_disabled', |
||
57 | 'type' => 'checkbox', |
||
58 | 'value' => 1, |
||
59 | 'default' => 0, |
||
60 | 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
||
61 | ) |
||
62 | ); |
||
63 | |||
64 | $cmb->add_field( |
||
65 | array( |
||
66 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
||
67 | 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
||
68 | 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
||
69 | 'id' => 'my_plan_slug', |
||
70 | 'type' => 'input', |
||
71 | 'value' => '', |
||
72 | 'default' => 'my-plan', |
||
73 | ) |
||
74 | ); |
||
75 | $cmb->add_field( |
||
76 | array( |
||
77 | 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
||
78 | 'id' => 'plan_single_slug', |
||
79 | 'type' => 'input', |
||
80 | 'value' => '', |
||
81 | 'default' => 'plan', |
||
82 | ) |
||
83 | ); |
||
84 | $cmb->add_field( |
||
85 | array( |
||
86 | 'name' => __( 'Plans Archive Endpoint', 'lsx-health-plan' ), |
||
87 | 'id' => 'endpoint_plan_archive', |
||
88 | 'type' => 'input', |
||
89 | 'value' => '', |
||
90 | 'default' => 'plans', |
||
91 | ) |
||
92 | ); |
||
93 | |||
94 | $cmb->add_field( |
||
95 | array( |
||
96 | 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
||
97 | 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
||
98 | 'desc' => 'Disable All Stats', |
||
99 | 'id' => 'disable_all_stats', |
||
100 | 'type' => 'checkbox', |
||
101 | 'value' => 1, |
||
102 | 'default' => 0, |
||
103 | ) |
||
104 | ); |
||
105 | $cmb->add_field( |
||
106 | array( |
||
107 | 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
||
108 | 'id' => 'disable_weight_checkbox', |
||
109 | 'type' => 'checkbox', |
||
110 | 'value' => 1, |
||
111 | 'default' => 0, |
||
112 | ) |
||
113 | ); |
||
114 | $cmb->add_field( |
||
115 | array( |
||
116 | 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
||
117 | 'id' => 'disable_height_checkbox', |
||
118 | 'type' => 'checkbox', |
||
119 | 'value' => 1, |
||
120 | 'default' => 0, |
||
121 | ) |
||
122 | ); |
||
123 | $cmb->add_field( |
||
124 | array( |
||
125 | 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
||
126 | 'id' => 'disable_waist_checkbox', |
||
127 | 'type' => 'checkbox', |
||
128 | 'value' => 1, |
||
129 | 'default' => 0, |
||
130 | ) |
||
131 | ); |
||
132 | $cmb->add_field( |
||
133 | array( |
||
134 | 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
||
135 | 'id' => 'disable_bmi_checkbox', |
||
136 | 'type' => 'checkbox', |
||
137 | 'value' => 1, |
||
138 | 'default' => 0, |
||
139 | ) |
||
144 |