Completed
Push — revert-5405-update/module-plac... ( 39c88e...712e0c )
by
unknown
21:19 queued 12:30
created

site-icon-functions.php ➔ jetpack_get_site_icon()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 25
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 9
nc 4
nop 4
dl 0
loc 25
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
if( ! function_exists( 'jetpack_site_icon_url' ) ) :
4
	function jetpack_site_icon_url( $blog_id = null, $size = '512', $default = false ) {
5
		$url = '';
0 ignored issues
show
Unused Code introduced by
$url is not used, you could remove the assignment.

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.

Loading history...
6
		if( ! is_int( $blog_id ) )
7
			$blog_id = get_current_blog_id();
8
		if( function_exists( 'get_blog_option' ) ) {
9
			$site_icon_id = get_blog_option( $blog_id, 'jetpack_site_icon_id' );
10
		} else {
11
			$site_icon_id = Jetpack_Options::get_option( 'site_icon_id' );
12
		}
13
		if( ! $site_icon_id  ) {
14
			if( $default === false && defined( 'SITE_ICON_DEFAULT_URL' ) )
15
				$url =  SITE_ICON_DEFAULT_URL;
16
			else
17
				$url = $default;
18
		} else {
19
			if( $size >= 512 ) {
20
				$size_data = 'full';
21
			} else {
22
				$size_data = array( $size, $size );
23
			}
24
			$url_data = wp_get_attachment_image_src( $site_icon_id, $size_data );
25
			$url = $url_data[0];
26
		}
27
		return $url;
28
	}
29
endif;
30