| Conditions | 12 | 
| Paths | 33 | 
| Total Lines | 47 | 
| Code Lines | 20 | 
| 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  | 
            ||
| 5 | function jetpack_post_details_enqueue_scripts() { | 
            ||
| 6 | // Make sure we can proceed.  | 
            ||
| 7 | list( $should_run, $options, $definied, $post_details ) = jetpack_post_details_should_run();  | 
            ||
| 8 | |||
| 9 | 	if ( ! $should_run ) { | 
            ||
| 10 | return;  | 
            ||
| 11 | }  | 
            ||
| 12 | |||
| 13 | list( $date_option, $categories_option, $tags_option, $author_option, $comment_option ) = $options;  | 
            ||
| 14 | list( $date, $categories, $tags, $author, $comment ) = $definied;  | 
            ||
| 15 | |||
| 16 | $elements = array();  | 
            ||
| 17 | |||
| 18 | // If date option is unticked, add it to the list of classes.  | 
            ||
| 19 | 	if ( 1 != $date_option && ! empty( $date ) ) { | 
            ||
| 20 | $elements[] = $date;  | 
            ||
| 21 | }  | 
            ||
| 22 | |||
| 23 | // If categories option is unticked, add it to the list of classes.  | 
            ||
| 24 | 	if ( 1 != $categories_option && ! empty( $categories ) ) { | 
            ||
| 25 | $elements[] = $categories;  | 
            ||
| 26 | }  | 
            ||
| 27 | |||
| 28 | // If tags option is unticked, add it to the list of classes.  | 
            ||
| 29 | 	if ( 1 != $tags_option && ! empty( $tags ) ) { | 
            ||
| 30 | $elements[] = $tags;  | 
            ||
| 31 | }  | 
            ||
| 32 | |||
| 33 | // If author option is unticked, add it to the list of classes.  | 
            ||
| 34 | 	if ( 1 != $author_option && ! empty( $author ) ) { | 
            ||
| 35 | $elements[] = $author;  | 
            ||
| 36 | }  | 
            ||
| 37 | |||
| 38 | // If comment option is unticked, add it to the list of classes.  | 
            ||
| 39 | 	if ( 1 != $comment_option && ! empty( $comment ) ) { | 
            ||
| 40 | $elements[] = $comment;  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | // Get the list of classes.  | 
            ||
| 44 | $elements = implode( ', ', $elements );  | 
            ||
| 45 | |||
| 46 | // Hide the classes with CSS.  | 
            ||
| 47 | 	$css = $elements . ' { clip: rect(1px, 1px, 1px, 1px); height: 1px; position: absolute; overflow: hidden; width: 1px; }'; | 
            ||
| 48 | |||
| 49 | // Add the CSS to the stylesheet.  | 
            ||
| 50 | wp_add_inline_style( $post_details['stylesheet'], $css );  | 
            ||
| 51 | }  | 
            ||
| 52 | add_action( 'wp_enqueue_scripts', 'jetpack_post_details_enqueue_scripts' );  | 
            ||
| 149 |