| Conditions | 3 |
| Paths | 1 |
| Total Lines | 152 |
| Code Lines | 94 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| 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 |
||
| 79 | 'type' => 'option', |
||
| 80 | 'capability' => 'manage_options', |
||
| 81 | 'sanitize_callback' => 'absint' |
||
| 82 | ) ); |
||
| 83 | } |
||
| 84 | |||
| 85 | $wp_customize->add_control( |
||
| 86 | new $class( |
||
| 87 | $wp_customize, |
||
| 88 | $name, |
||
| 89 | array( |
||
| 90 | 'label' => $settings['control']['label'], |
||
| 91 | 'section' => $settings['control']['section'], |
||
| 92 | 'settings' => $settings['control']['settings'] |
||
| 93 | ) |
||
| 94 | ) |
||
| 95 | ); |
||
| 96 | } else { |
||
| 97 | $wp_customize->add_control( $name, $settings['control'] ); |
||
| 98 | } |
||
| 99 | |||
| 100 | if ( isset( $settings['partial'] ) ) { |
||
| 101 | $wp_customize->selective_refresh->add_partial( $name, $settings['partial'] ); |
||
| 102 | } |
||
| 103 | } |
||
| 104 | } |
||
| 105 | } |
||
| 106 | |||
| 107 | new WPSC_Customizer(); |
||
| 108 |