Conditions | 1 |
Paths | 1 |
Total Lines | 57 |
Code Lines | 38 |
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 |
||
131 | public function global_defaults( $cmb ) { |
||
132 | $cmb->add_field( |
||
133 | array( |
||
134 | 'id' => 'global_defaults_title', |
||
135 | 'type' => 'title', |
||
136 | 'name' => __( 'Careers CTA', 'lsx-team' ), |
||
137 | 'default' => __( 'Careers CTA', 'lsx-team' ), |
||
138 | ) |
||
139 | ); |
||
140 | |||
141 | $cmb->add_field( |
||
142 | array( |
||
143 | 'name' => __( 'Enable careers CTA', 'lsx-team' ), |
||
144 | 'id' => 'team_careers_cta_enable', |
||
145 | 'type' => 'checkbox', |
||
146 | 'value' => 1, |
||
147 | 'default' => 0, |
||
148 | 'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ), |
||
149 | ) |
||
150 | ); |
||
151 | |||
152 | $cmb->add_field( |
||
153 | array( |
||
154 | 'name' => __( 'Title', 'lsx-team' ), |
||
155 | 'id' => 'team_careers_cta_title', |
||
156 | 'type' => 'text', |
||
157 | ) |
||
158 | ); |
||
159 | |||
160 | $cmb->add_field( |
||
161 | array( |
||
162 | 'name' => __( 'Tagline', 'lsx-team' ), |
||
163 | 'id' => 'team_careers_cta_tagline', |
||
164 | 'type' => 'text', |
||
165 | ) |
||
166 | ); |
||
167 | |||
168 | $cmb->add_field( |
||
169 | array( |
||
170 | 'name' => __( 'Link Text', 'lsx-team' ), |
||
171 | 'id' => 'team_careers_cta_link_text', |
||
172 | 'type' => 'text', |
||
173 | ) |
||
174 | ); |
||
175 | |||
176 | $cmb->add_field( |
||
177 | array( |
||
178 | 'name' => __( 'Careers page link', 'lsx-team' ), |
||
179 | 'id' => 'team_careers_cta_link', |
||
180 | 'type' => 'text', |
||
181 | ) |
||
182 | ); |
||
183 | |||
184 | $cmb->add_field( |
||
185 | array( |
||
186 | 'id' => 'settings_global_defaults_closing', |
||
187 | 'type' => 'tab_closing', |
||
188 | ) |
||
193 |