| Conditions | 16 | 
| Paths | 195 | 
| Total Lines | 49 | 
| Code Lines | 30 | 
| 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  | 
            ||
| 100 | function jetpack_post_details_should_run() { | 
            ||
| 101 | // Empty value representing falsy return value.  | 
            ||
| 102 | $void = array( false, null, null, null );  | 
            ||
| 103 | |||
| 104 | // If the theme doesn't support 'jetpack-content-options', don't continue.  | 
            ||
| 105 | 	if ( ! current_theme_supports( 'jetpack-content-options' ) ) { | 
            ||
| 106 | return $void;  | 
            ||
| 107 | }  | 
            ||
| 108 | |||
| 109 | $options = get_theme_support( 'jetpack-content-options' );  | 
            ||
| 110 | $post_details = ( ! empty( $options[0]['post-details'] ) ) ? $options[0]['post-details'] : null;  | 
            ||
| 111 | |||
| 112 | // If the theme doesn't support 'jetpack-content-options[ 'post-details' ]', don't continue.  | 
            ||
| 113 | 	if ( empty( $post_details ) ) { | 
            ||
| 114 | return $void;  | 
            ||
| 115 | }  | 
            ||
| 116 | |||
| 117 | $date = ( ! empty( $post_details['date'] ) ) ? $post_details['date'] : null;  | 
            ||
| 118 | $categories = ( ! empty( $post_details['categories'] ) ) ? $post_details['categories'] : null;  | 
            ||
| 119 | $tags = ( ! empty( $post_details['tags'] ) ) ? $post_details['tags'] : null;  | 
            ||
| 120 | $author = ( ! empty( $post_details['author'] ) ) ? $post_details['author'] : null;  | 
            ||
| 121 | $comment = ( ! empty( $post_details['comment'] ) ) ? $post_details['comment'] : null;  | 
            ||
| 122 | |||
| 123 | // If there is no stylesheet and there are no date, categories, tags, author or comment declared, don't continue.  | 
            ||
| 124 | if ( empty( $post_details['stylesheet'] )  | 
            ||
| 125 | && ( empty( $date )  | 
            ||
| 126 | || empty( $categories )  | 
            ||
| 127 | || empty( $tags )  | 
            ||
| 128 | || empty( $author )  | 
            ||
| 129 | 			 || empty( $comment ) ) ) { | 
            ||
| 130 | return $void;  | 
            ||
| 131 | }  | 
            ||
| 132 | |||
| 133 | $date_option = get_option( 'jetpack_content_post_details_date', 1 );  | 
            ||
| 134 | $categories_option = get_option( 'jetpack_content_post_details_categories', 1 );  | 
            ||
| 135 | $tags_option = get_option( 'jetpack_content_post_details_tags', 1 );  | 
            ||
| 136 | $author_option = get_option( 'jetpack_content_post_details_author', 1 );  | 
            ||
| 137 | $comment_option = get_option( 'jetpack_content_post_details_comment', 1 );  | 
            ||
| 138 | |||
| 139 | $options = array( $date_option, $categories_option, $tags_option, $author_option, $comment_option );  | 
            ||
| 140 | $definied = array( $date, $categories, $tags, $author, $comment );  | 
            ||
| 141 | |||
| 142 | // If all the options are ticked, don't continue.  | 
            ||
| 143 | 	if ( array( 1, 1, 1, 1, 1 ) === $options ) { | 
            ||
| 144 | return $void;  | 
            ||
| 145 | }  | 
            ||
| 146 | |||
| 147 | return array( true, $options, $definied, $post_details );  | 
            ||
| 148 | }  | 
            ||
| 149 |