Conditions | 2 |
Paths | 2 |
Total Lines | 61 |
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 |
||
133 | function render_field_settings( $field ) { |
||
134 | |||
135 | // ACF4 migration |
||
136 | if( empty($field['ID']) ) { |
||
137 | |||
138 | $field['new_lines'] = 'wpautop'; |
||
139 | |||
140 | } |
||
141 | |||
142 | |||
143 | // default_value |
||
144 | acf_render_field_setting( $field, array( |
||
145 | 'label' => __('Default Value','acf'), |
||
146 | 'instructions' => __('Appears when creating a new post','acf'), |
||
147 | 'type' => 'textarea', |
||
148 | 'name' => 'default_value', |
||
149 | )); |
||
150 | |||
151 | |||
152 | // placeholder |
||
153 | acf_render_field_setting( $field, array( |
||
154 | 'label' => __('Placeholder Text','acf'), |
||
155 | 'instructions' => __('Appears within the input','acf'), |
||
156 | 'type' => 'text', |
||
157 | 'name' => 'placeholder', |
||
158 | )); |
||
159 | |||
160 | |||
161 | // maxlength |
||
162 | acf_render_field_setting( $field, array( |
||
163 | 'label' => __('Character Limit','acf'), |
||
164 | 'instructions' => __('Leave blank for no limit','acf'), |
||
165 | 'type' => 'number', |
||
166 | 'name' => 'maxlength', |
||
167 | )); |
||
168 | |||
169 | |||
170 | // rows |
||
171 | acf_render_field_setting( $field, array( |
||
172 | 'label' => __('Rows','acf'), |
||
173 | 'instructions' => __('Sets the textarea height','acf'), |
||
174 | 'type' => 'number', |
||
175 | 'name' => 'rows', |
||
176 | 'placeholder' => 8 |
||
177 | )); |
||
178 | |||
179 | |||
180 | // formatting |
||
181 | acf_render_field_setting( $field, array( |
||
182 | 'label' => __('New Lines','acf'), |
||
183 | 'instructions' => __('Controls how new lines are rendered','acf'), |
||
184 | 'type' => 'select', |
||
185 | 'name' => 'new_lines', |
||
186 | 'choices' => array( |
||
187 | 'wpautop' => __("Automatically add paragraphs",'acf'), |
||
188 | 'br' => __("Automatically add <br>",'acf'), |
||
189 | '' => __("No Formatting",'acf') |
||
190 | ) |
||
191 | )); |
||
192 | |||
193 | } |
||
194 | |||
245 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.