for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
if( ! function_exists( 'jetpack_site_icon_url' ) ) :
function jetpack_site_icon_url( $blog_id = null, $size = '512', $default = false ) {
$url = '';
$url
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
if( ! is_int( $blog_id ) )
$blog_id = get_current_blog_id();
if( function_exists( 'get_blog_option' ) ) {
$site_icon_id = get_blog_option( $blog_id, 'jetpack_site_icon_id' );
} else {
$site_icon_id = Jetpack_Options::get_option( 'site_icon_id' );
}
if( ! $site_icon_id ) {
if( $default === false && defined( 'SITE_ICON_DEFAULT_URL' ) )
$url = SITE_ICON_DEFAULT_URL;
else
$url = $default;
if( $size >= 512 ) {
$size_data = 'full';
$size_data = array( $size, $size );
$url_data = wp_get_attachment_image_src( $site_icon_id, $size_data );
$url = $url_data[0];
return $url;
endif;
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.