Showing 8 of 10 total issues
Method get_sizes
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_sizes( $mode = '' ) {
$sizes = array(
'default' => array(
16,
32,
Function generate_ico_file
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function generate_ico_file( $attachment_id, $source_file ) {
$destination_file = explode( '.', $source_file );
$destination_file[ count( $destination_file ) - 1 ] = 'ico';
$destination_file = implode( '.', $destination_file );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function maybe_generate_ico_attachment_check
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function maybe_generate_ico_attachment_check() {
if ( ! current_user_can( 'upload_files' ) ) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method customize_register_pinned_tab_icon
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function customize_register_pinned_tab_icon( $wp_customize ) {
$site_icon_control = $wp_customize->get_control( 'site_icon' );
if ( ! $site_icon_control ) {
return;
}
Function maybe_generate_ico_attachment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function maybe_generate_ico_attachment( $attachment_id ) {
$attachment_context = get_post_meta( $attachment_id, '_wp_attachment_context', true );
if ( 'site-icon' !== $attachment_context ) {
return false;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_browserconfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function get_browserconfig() {
$content = '<browserconfig>' . "\n";
$content .= '<msapplication>' . "\n";
$content .= '<tile>' . "\n";
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return true;
Function maybe_delete_ico_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function maybe_delete_ico_file( $attachment_id ) {
$site_icon_id = get_option( 'site_icon' );
$ico_id = get_post_meta( $site_icon_id, 'wpsie_ico_id', true );
if ( $site_icon_id && $attachment_id == $site_icon_id ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"