Conditions | 1 |
Paths | 1 |
Total Lines | 471 |
Code Lines | 383 |
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 |
||
84 | public function get_item_schema() { |
||
85 | $schema = array( |
||
86 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
||
87 | 'title' => 'system_status', |
||
88 | 'type' => 'object', |
||
89 | 'properties' => array( |
||
90 | 'environment' => array( |
||
91 | 'description' => __( 'Environment.', 'woocommerce' ), |
||
92 | 'type' => 'object', |
||
93 | 'context' => array( 'view' ), |
||
94 | 'readonly' => true, |
||
95 | 'properties' => array( |
||
96 | 'home_url' => array( |
||
97 | 'description' => __( 'Home URL.', 'woocommerce' ), |
||
98 | 'type' => 'string', |
||
99 | 'format' => 'uri', |
||
100 | 'context' => array( 'view' ), |
||
101 | 'readonly' => true, |
||
102 | ), |
||
103 | 'site_url' => array( |
||
104 | 'description' => __( 'Site URL.', 'woocommerce' ), |
||
105 | 'type' => 'string', |
||
106 | 'format' => 'uri', |
||
107 | 'context' => array( 'view' ), |
||
108 | 'readonly' => true, |
||
109 | ), |
||
110 | 'wc_version' => array( |
||
111 | 'description' => __( 'WooCommerce version.', 'woocommerce' ), |
||
112 | 'type' => 'string', |
||
113 | 'context' => array( 'view' ), |
||
114 | 'readonly' => true, |
||
115 | ), |
||
116 | 'log_directory' => array( |
||
117 | 'description' => __( 'Log directory.', 'woocommerce' ), |
||
118 | 'type' => 'string', |
||
119 | 'context' => array( 'view' ), |
||
120 | 'readonly' => true, |
||
121 | ), |
||
122 | 'log_directory_writable' => array( |
||
123 | 'description' => __( 'Is log directory writable?', 'woocommerce' ), |
||
124 | 'type' => 'boolean', |
||
125 | 'context' => array( 'view' ), |
||
126 | 'readonly' => true, |
||
127 | ), |
||
128 | 'wp_version' => array( |
||
129 | 'description' => __( 'WordPress version.', 'woocommerce' ), |
||
130 | 'type' => 'string', |
||
131 | 'context' => array( 'view' ), |
||
132 | 'readonly' => true, |
||
133 | ), |
||
134 | 'wp_multisite' => array( |
||
135 | 'description' => __( 'Is WordPress multisite?', 'woocommerce' ), |
||
136 | 'type' => 'boolean', |
||
137 | 'context' => array( 'view' ), |
||
138 | 'readonly' => true, |
||
139 | ), |
||
140 | 'wp_memory_limit' => array( |
||
141 | 'description' => __( 'WordPress memory limit.', 'woocommerce' ), |
||
142 | 'type' => 'integer', |
||
143 | 'context' => array( 'view' ), |
||
144 | 'readonly' => true, |
||
145 | ), |
||
146 | 'wp_debug_mode' => array( |
||
147 | 'description' => __( 'Is WordPress debug mode active?', 'woocommerce' ), |
||
148 | 'type' => 'boolean', |
||
149 | 'context' => array( 'view' ), |
||
150 | 'readonly' => true, |
||
151 | ), |
||
152 | 'wp_cron' => array( |
||
153 | 'description' => __( 'Are WordPress cron jobs enabled?', 'woocommerce' ), |
||
154 | 'type' => 'boolean', |
||
155 | 'context' => array( 'view' ), |
||
156 | 'readonly' => true, |
||
157 | ), |
||
158 | 'language' => array( |
||
159 | 'description' => __( 'WordPress language.', 'woocommerce' ), |
||
160 | 'type' => 'string', |
||
161 | 'context' => array( 'view' ), |
||
162 | 'readonly' => true, |
||
163 | ), |
||
164 | 'server_info' => array( |
||
165 | 'description' => __( 'Server info.', 'woocommerce' ), |
||
166 | 'type' => 'string', |
||
167 | 'context' => array( 'view' ), |
||
168 | 'readonly' => true, |
||
169 | ), |
||
170 | 'php_version' => array( |
||
171 | 'description' => __( 'PHP version.', 'woocommerce' ), |
||
172 | 'type' => 'string', |
||
173 | 'context' => array( 'view' ), |
||
174 | 'readonly' => true, |
||
175 | ), |
||
176 | 'php_post_max_size' => array( |
||
177 | 'description' => __( 'PHP post max size.', 'woocommerce' ), |
||
178 | 'type' => 'integer', |
||
179 | 'context' => array( 'view' ), |
||
180 | 'readonly' => true, |
||
181 | ), |
||
182 | 'php_max_execution_time' => array( |
||
183 | 'description' => __( 'PHP max execution time.', 'woocommerce' ), |
||
184 | 'type' => 'integer', |
||
185 | 'context' => array( 'view' ), |
||
186 | 'readonly' => true, |
||
187 | ), |
||
188 | 'php_max_input_vars' => array( |
||
189 | 'description' => __( 'PHP max input vars.', 'woocommerce' ), |
||
190 | 'type' => 'integer', |
||
191 | 'context' => array( 'view' ), |
||
192 | 'readonly' => true, |
||
193 | ), |
||
194 | 'curl_version' => array( |
||
195 | 'description' => __( 'cURL version.', 'woocommerce' ), |
||
196 | 'type' => 'string', |
||
197 | 'context' => array( 'view' ), |
||
198 | 'readonly' => true, |
||
199 | ), |
||
200 | 'suhosin_installed' => array( |
||
201 | 'description' => __( 'Is SUHOSIN installed?', 'woocommerce' ), |
||
202 | 'type' => 'boolean', |
||
203 | 'context' => array( 'view' ), |
||
204 | 'readonly' => true, |
||
205 | ), |
||
206 | 'max_upload_size' => array( |
||
207 | 'description' => __( 'Max upload size.', 'woocommerce' ), |
||
208 | 'type' => 'integer', |
||
209 | 'context' => array( 'view' ), |
||
210 | 'readonly' => true, |
||
211 | ), |
||
212 | 'mysql_version' => array( |
||
213 | 'description' => __( 'MySQL version.', 'woocommerce' ), |
||
214 | 'type' => 'string', |
||
215 | 'context' => array( 'view' ), |
||
216 | 'readonly' => true, |
||
217 | ), |
||
218 | 'mysql_version_string' => array( |
||
219 | 'description' => __( 'MySQL version string.', 'woocommerce' ), |
||
220 | 'type' => 'string', |
||
221 | 'context' => array( 'view' ), |
||
222 | 'readonly' => true, |
||
223 | ), |
||
224 | 'default_timezone' => array( |
||
225 | 'description' => __( 'Default timezone.', 'woocommerce' ), |
||
226 | 'type' => 'string', |
||
227 | 'context' => array( 'view' ), |
||
228 | 'readonly' => true, |
||
229 | ), |
||
230 | 'fsockopen_or_curl_enabled' => array( |
||
231 | 'description' => __( 'Is fsockopen/cURL enabled?', 'woocommerce' ), |
||
232 | 'type' => 'boolean', |
||
233 | 'context' => array( 'view' ), |
||
234 | 'readonly' => true, |
||
235 | ), |
||
236 | 'soapclient_enabled' => array( |
||
237 | 'description' => __( 'Is SoapClient class enabled?', 'woocommerce' ), |
||
238 | 'type' => 'boolean', |
||
239 | 'context' => array( 'view' ), |
||
240 | 'readonly' => true, |
||
241 | ), |
||
242 | 'domdocument_enabled' => array( |
||
243 | 'description' => __( 'Is DomDocument class enabled?', 'woocommerce' ), |
||
244 | 'type' => 'boolean', |
||
245 | 'context' => array( 'view' ), |
||
246 | 'readonly' => true, |
||
247 | ), |
||
248 | 'gzip_enabled' => array( |
||
249 | 'description' => __( 'Is GZip enabled?', 'woocommerce' ), |
||
250 | 'type' => 'boolean', |
||
251 | 'context' => array( 'view' ), |
||
252 | 'readonly' => true, |
||
253 | ), |
||
254 | 'mbstring_enabled' => array( |
||
255 | 'description' => __( 'Is mbstring enabled?', 'woocommerce' ), |
||
256 | 'type' => 'boolean', |
||
257 | 'context' => array( 'view' ), |
||
258 | 'readonly' => true, |
||
259 | ), |
||
260 | 'remote_post_successful' => array( |
||
261 | 'description' => __( 'Remote POST successful?', 'woocommerce' ), |
||
262 | 'type' => 'boolean', |
||
263 | 'context' => array( 'view' ), |
||
264 | 'readonly' => true, |
||
265 | ), |
||
266 | 'remote_post_response' => array( |
||
267 | 'description' => __( 'Remote POST response.', 'woocommerce' ), |
||
268 | 'type' => 'string', |
||
269 | 'context' => array( 'view' ), |
||
270 | 'readonly' => true, |
||
271 | ), |
||
272 | 'remote_get_successful' => array( |
||
273 | 'description' => __( 'Remote GET successful?', 'woocommerce' ), |
||
274 | 'type' => 'boolean', |
||
275 | 'context' => array( 'view' ), |
||
276 | 'readonly' => true, |
||
277 | ), |
||
278 | 'remote_get_response' => array( |
||
279 | 'description' => __( 'Remote GET response.', 'woocommerce' ), |
||
280 | 'type' => 'string', |
||
281 | 'context' => array( 'view' ), |
||
282 | 'readonly' => true, |
||
283 | ), |
||
284 | ), |
||
285 | ), |
||
286 | 'database' => array( |
||
287 | 'description' => __( 'Database.', 'woocommerce' ), |
||
288 | 'type' => 'object', |
||
289 | 'context' => array( 'view' ), |
||
290 | 'readonly' => true, |
||
291 | 'properties' => array( |
||
292 | 'wc_database_version' => array( |
||
293 | 'description' => __( 'WC database version.', 'woocommerce' ), |
||
294 | 'type' => 'string', |
||
295 | 'context' => array( 'view' ), |
||
296 | 'readonly' => true, |
||
297 | ), |
||
298 | 'database_prefix' => array( |
||
299 | 'description' => __( 'Database prefix.', 'woocommerce' ), |
||
300 | 'type' => 'string', |
||
301 | 'context' => array( 'view' ), |
||
302 | 'readonly' => true, |
||
303 | ), |
||
304 | 'maxmind_geoip_database' => array( |
||
305 | 'description' => __( 'MaxMind GeoIP database.', 'woocommerce' ), |
||
306 | 'type' => 'string', |
||
307 | 'context' => array( 'view' ), |
||
308 | 'readonly' => true, |
||
309 | ), |
||
310 | 'database_tables' => array( |
||
311 | 'description' => __( 'Database tables.', 'woocommerce' ), |
||
312 | 'type' => 'array', |
||
313 | 'context' => array( 'view' ), |
||
314 | 'readonly' => true, |
||
315 | 'items' => array( |
||
316 | 'type' => 'string', |
||
317 | ), |
||
318 | ), |
||
319 | ), |
||
320 | ), |
||
321 | 'active_plugins' => array( |
||
322 | 'description' => __( 'Active plugins.', 'woocommerce' ), |
||
323 | 'type' => 'array', |
||
324 | 'context' => array( 'view' ), |
||
325 | 'readonly' => true, |
||
326 | 'items' => array( |
||
327 | 'type' => 'string', |
||
328 | ), |
||
329 | ), |
||
330 | 'inactive_plugins' => array( |
||
331 | 'description' => __( 'Inactive plugins.', 'woocommerce' ), |
||
332 | 'type' => 'array', |
||
333 | 'context' => array( 'view' ), |
||
334 | 'readonly' => true, |
||
335 | 'items' => array( |
||
336 | 'type' => 'string', |
||
337 | ), |
||
338 | ), |
||
339 | 'dropins_mu_plugins' => array( |
||
340 | 'description' => __( 'Dropins & MU plugins.', 'woocommerce' ), |
||
341 | 'type' => 'array', |
||
342 | 'context' => array( 'view' ), |
||
343 | 'readonly' => true, |
||
344 | 'items' => array( |
||
345 | 'type' => 'string', |
||
346 | ), |
||
347 | ), |
||
348 | 'theme' => array( |
||
349 | 'description' => __( 'Theme.', 'woocommerce' ), |
||
350 | 'type' => 'object', |
||
351 | 'context' => array( 'view' ), |
||
352 | 'readonly' => true, |
||
353 | 'properties' => array( |
||
354 | 'name' => array( |
||
355 | 'description' => __( 'Theme name.', 'woocommerce' ), |
||
356 | 'type' => 'string', |
||
357 | 'context' => array( 'view' ), |
||
358 | 'readonly' => true, |
||
359 | ), |
||
360 | 'version' => array( |
||
361 | 'description' => __( 'Theme version.', 'woocommerce' ), |
||
362 | 'type' => 'string', |
||
363 | 'context' => array( 'view' ), |
||
364 | 'readonly' => true, |
||
365 | ), |
||
366 | 'version_latest' => array( |
||
367 | 'description' => __( 'Latest version of theme.', 'woocommerce' ), |
||
368 | 'type' => 'string', |
||
369 | 'context' => array( 'view' ), |
||
370 | 'readonly' => true, |
||
371 | ), |
||
372 | 'author_url' => array( |
||
373 | 'description' => __( 'Theme author URL.', 'woocommerce' ), |
||
374 | 'type' => 'string', |
||
375 | 'format' => 'uri', |
||
376 | 'context' => array( 'view' ), |
||
377 | 'readonly' => true, |
||
378 | ), |
||
379 | 'is_child_theme' => array( |
||
380 | 'description' => __( 'Is this theme a child theme?', 'woocommerce' ), |
||
381 | 'type' => 'boolean', |
||
382 | 'context' => array( 'view' ), |
||
383 | 'readonly' => true, |
||
384 | ), |
||
385 | 'has_woocommerce_support' => array( |
||
386 | 'description' => __( 'Does the theme declare WooCommerce support?', 'woocommerce' ), |
||
387 | 'type' => 'boolean', |
||
388 | 'context' => array( 'view' ), |
||
389 | 'readonly' => true, |
||
390 | ), |
||
391 | 'has_woocommerce_file' => array( |
||
392 | 'description' => __( 'Does the theme have a woocommerce.php file?', 'woocommerce' ), |
||
393 | 'type' => 'boolean', |
||
394 | 'context' => array( 'view' ), |
||
395 | 'readonly' => true, |
||
396 | ), |
||
397 | 'has_outdated_templates' => array( |
||
398 | 'description' => __( 'Does this theme have outdated templates?', 'woocommerce' ), |
||
399 | 'type' => 'boolean', |
||
400 | 'context' => array( 'view' ), |
||
401 | 'readonly' => true, |
||
402 | ), |
||
403 | 'overrides' => array( |
||
404 | 'description' => __( 'Template overrides.', 'woocommerce' ), |
||
405 | 'type' => 'array', |
||
406 | 'context' => array( 'view' ), |
||
407 | 'readonly' => true, |
||
408 | 'items' => array( |
||
409 | 'type' => 'string', |
||
410 | ), |
||
411 | ), |
||
412 | 'parent_name' => array( |
||
413 | 'description' => __( 'Parent theme name.', 'woocommerce' ), |
||
414 | 'type' => 'string', |
||
415 | 'context' => array( 'view' ), |
||
416 | 'readonly' => true, |
||
417 | ), |
||
418 | 'parent_version' => array( |
||
419 | 'description' => __( 'Parent theme version.', 'woocommerce' ), |
||
420 | 'type' => 'string', |
||
421 | 'context' => array( 'view' ), |
||
422 | 'readonly' => true, |
||
423 | ), |
||
424 | 'parent_author_url' => array( |
||
425 | 'description' => __( 'Parent theme author URL.', 'woocommerce' ), |
||
426 | 'type' => 'string', |
||
427 | 'format' => 'uri', |
||
428 | 'context' => array( 'view' ), |
||
429 | 'readonly' => true, |
||
430 | ), |
||
431 | ), |
||
432 | ), |
||
433 | 'settings' => array( |
||
434 | 'description' => __( 'Settings.', 'woocommerce' ), |
||
435 | 'type' => 'object', |
||
436 | 'context' => array( 'view' ), |
||
437 | 'readonly' => true, |
||
438 | 'properties' => array( |
||
439 | 'api_enabled' => array( |
||
440 | 'description' => __( 'REST API enabled?', 'woocommerce' ), |
||
441 | 'type' => 'boolean', |
||
442 | 'context' => array( 'view' ), |
||
443 | 'readonly' => true, |
||
444 | ), |
||
445 | 'force_ssl' => array( |
||
446 | 'description' => __( 'SSL forced?', 'woocommerce' ), |
||
447 | 'type' => 'boolean', |
||
448 | 'context' => array( 'view' ), |
||
449 | 'readonly' => true, |
||
450 | ), |
||
451 | 'currency' => array( |
||
452 | 'description' => __( 'Currency.', 'woocommerce' ), |
||
453 | 'type' => 'string', |
||
454 | 'context' => array( 'view' ), |
||
455 | 'readonly' => true, |
||
456 | ), |
||
457 | 'currency_symbol' => array( |
||
458 | 'description' => __( 'Currency symbol.', 'woocommerce' ), |
||
459 | 'type' => 'string', |
||
460 | 'context' => array( 'view' ), |
||
461 | 'readonly' => true, |
||
462 | ), |
||
463 | 'currency_position' => array( |
||
464 | 'description' => __( 'Currency position.', 'woocommerce' ), |
||
465 | 'type' => 'string', |
||
466 | 'context' => array( 'view' ), |
||
467 | 'readonly' => true, |
||
468 | ), |
||
469 | 'thousand_separator' => array( |
||
470 | 'description' => __( 'Thousand separator.', 'woocommerce' ), |
||
471 | 'type' => 'string', |
||
472 | 'context' => array( 'view' ), |
||
473 | 'readonly' => true, |
||
474 | ), |
||
475 | 'decimal_separator' => array( |
||
476 | 'description' => __( 'Decimal separator.', 'woocommerce' ), |
||
477 | 'type' => 'string', |
||
478 | 'context' => array( 'view' ), |
||
479 | 'readonly' => true, |
||
480 | ), |
||
481 | 'number_of_decimals' => array( |
||
482 | 'description' => __( 'Number of decimals.', 'woocommerce' ), |
||
483 | 'type' => 'integer', |
||
484 | 'context' => array( 'view' ), |
||
485 | 'readonly' => true, |
||
486 | ), |
||
487 | 'geolocation_enabled' => array( |
||
488 | 'description' => __( 'Geolocation enabled?', 'woocommerce' ), |
||
489 | 'type' => 'boolean', |
||
490 | 'context' => array( 'view' ), |
||
491 | 'readonly' => true, |
||
492 | ), |
||
493 | 'taxonomies' => array( |
||
494 | 'description' => __( 'Taxonomy terms for product/order statuses.', 'woocommerce' ), |
||
495 | 'type' => 'array', |
||
496 | 'context' => array( 'view' ), |
||
497 | 'readonly' => true, |
||
498 | 'items' => array( |
||
499 | 'type' => 'string', |
||
500 | ), |
||
501 | ), |
||
502 | 'product_visibility_terms' => array( |
||
503 | 'description' => __( 'Terms in the product visibility taxonomy.', 'woocommerce' ), |
||
504 | 'type' => 'array', |
||
505 | 'context' => array( 'view' ), |
||
506 | 'readonly' => true, |
||
507 | 'items' => array( |
||
508 | 'type' => 'string', |
||
509 | ), |
||
510 | ), |
||
511 | ), |
||
512 | ), |
||
513 | 'security' => array( |
||
514 | 'description' => __( 'Security.', 'woocommerce' ), |
||
515 | 'type' => 'object', |
||
516 | 'context' => array( 'view' ), |
||
517 | 'readonly' => true, |
||
518 | 'properties' => array( |
||
519 | 'secure_connection' => array( |
||
520 | 'description' => __( 'Is the connection to your store secure?', 'woocommerce' ), |
||
521 | 'type' => 'boolean', |
||
522 | 'context' => array( 'view' ), |
||
523 | 'readonly' => true, |
||
524 | ), |
||
525 | 'hide_errors' => array( |
||
526 | 'description' => __( 'Hide errors from visitors?', 'woocommerce' ), |
||
527 | 'type' => 'boolean', |
||
528 | 'context' => array( 'view' ), |
||
529 | 'readonly' => true, |
||
530 | ), |
||
531 | ), |
||
532 | ), |
||
533 | 'pages' => array( |
||
534 | 'description' => __( 'WooCommerce pages.', 'woocommerce' ), |
||
535 | 'type' => 'array', |
||
536 | 'context' => array( 'view' ), |
||
537 | 'readonly' => true, |
||
538 | 'items' => array( |
||
539 | 'type' => 'string', |
||
540 | ), |
||
541 | ), |
||
542 | 'post_type_counts' => array( |
||
543 | 'description' => __( 'Post type counts.', 'woocommerce' ), |
||
544 | 'type' => 'array', |
||
545 | 'context' => array( 'view' ), |
||
546 | 'readonly' => true, |
||
547 | 'items' => array( |
||
548 | 'type' => 'string', |
||
549 | ), |
||
550 | ), |
||
551 | ), |
||
552 | ); |
||
553 | |||
554 | return $this->add_additional_fields_schema( $schema ); |
||
555 | } |
||
617 |