| Conditions | 1 |
| Paths | 1 |
| Total Lines | 89 |
| Code Lines | 66 |
| 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 |
||
| 13 | public static function register_settings() { |
||
| 14 | |||
| 15 | $args = array( |
||
| 16 | 'description' => '', |
||
| 17 | 'sanitize_callback' => array( __CLASS__, 'sanitize_settings' ), |
||
| 18 | ); |
||
| 19 | |||
| 20 | register_setting( |
||
| 21 | 'podlove-psb', |
||
| 22 | 'podlove_psb_defaults', |
||
| 23 | $args |
||
| 24 | ); |
||
| 25 | |||
| 26 | add_settings_section( |
||
| 27 | 'podlove-psb-defaults', |
||
| 28 | __( 'Default Settings', 'podlove-subscribe-button' ), |
||
| 29 | '__return_empty_string', |
||
| 30 | 'podlove-psb' |
||
| 31 | ); |
||
| 32 | |||
| 33 | add_settings_field( |
||
| 34 | 'size', |
||
| 35 | __( 'Size', 'podlove-subscribe-button' ), |
||
| 36 | array( __CLASS__, 'field' ), |
||
| 37 | 'podlove-psb', |
||
| 38 | 'podlove-psb-defaults', |
||
| 39 | array( |
||
| 40 | 'label_for' => 'size', |
||
| 41 | 'type' => 'select', |
||
| 42 | ) |
||
| 43 | ); |
||
| 44 | |||
| 45 | add_settings_field( |
||
| 46 | 'autowidth', |
||
| 47 | __( 'Autowidth', 'podlove-subscribe-button' ), |
||
| 48 | array( __CLASS__, 'field' ), |
||
| 49 | 'podlove-psb', |
||
| 50 | 'podlove-psb-defaults', |
||
| 51 | array( |
||
| 52 | 'label_for' => 'autowidth', |
||
| 53 | 'type' => 'checkbox', |
||
| 54 | ) |
||
| 55 | ); |
||
| 56 | |||
| 57 | add_settings_field( |
||
| 58 | 'color', |
||
| 59 | __( 'Color', 'podlove-subscribe-button' ), |
||
| 60 | array( __CLASS__, 'field' ), |
||
| 61 | 'podlove-psb', |
||
| 62 | 'podlove-psb-defaults', |
||
| 63 | array( |
||
| 64 | 'label_for' => 'color', |
||
| 65 | 'type' => 'color', |
||
| 66 | ) |
||
| 67 | ); |
||
| 68 | |||
| 69 | add_settings_field( |
||
| 70 | 'style', |
||
| 71 | __( 'Style', 'podlove-subscribe-button' ), |
||
| 72 | array( __CLASS__, 'field' ), |
||
| 73 | 'podlove-psb', |
||
| 74 | 'podlove-psb-defaults', |
||
| 75 | array( |
||
| 76 | 'label_for' => 'style', |
||
| 77 | 'type' => 'select', |
||
| 78 | ) |
||
| 79 | ); |
||
| 80 | |||
| 81 | add_settings_field( |
||
| 82 | 'format', |
||
| 83 | __( 'Format', 'podlove-subscribe-button' ), |
||
| 84 | array( __CLASS__, 'field' ), |
||
| 85 | 'podlove-psb', |
||
| 86 | 'podlove-psb-defaults', |
||
| 87 | array( |
||
| 88 | 'label_for' => 'format', |
||
| 89 | 'type' => 'select', |
||
| 90 | ) |
||
| 91 | ); |
||
| 92 | |||
| 93 | add_settings_field( |
||
| 94 | 'language', |
||
| 95 | __( 'Language', 'podlove-subscribe-button' ), |
||
| 96 | array( __CLASS__, 'field' ), |
||
| 97 | 'podlove-psb', |
||
| 98 | 'podlove-psb-defaults', |
||
| 99 | array( |
||
| 100 | 'label_for' => 'language', |
||
| 101 | 'type' => 'language', |
||
| 102 | ) |
||
| 165 |