tinywp_auto_plugin_theme_update_email()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 9
rs 10
1
<?php
2
3
// Ref: https://make.wordpress.org/core/2020/07/30/controlling-plugin-and-theme-auto-update-email-notifications-and-site-health-infos-in-wp-5-5/
4
5
function tinywp_auto_plugin_theme_update_email( $email, $type, $successful_updates, $failed_updates ) {
0 ignored issues
show
Unused Code introduced by
The parameter $successful_updates is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

5
function tinywp_auto_plugin_theme_update_email( $email, $type, /** @scrutinizer ignore-unused */ $successful_updates, $failed_updates ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $failed_updates is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

5
function tinywp_auto_plugin_theme_update_email( $email, $type, $successful_updates, /** @scrutinizer ignore-unused */ $failed_updates ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
6
    // You may change the email recipient. Default is site admin email.
7
    // $email['to'] = '[email protected]';
8
    // You may change the email subject when updates failed
9
    if ( 'fail' === $type ) {
10
        $email['subject'] = __( 'ATTN: IT Department – SOME AUTO-UPDATES WENT WRONG!', 'my-plugin' );
0 ignored issues
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

10
        $email['subject'] = /** @scrutinizer ignore-call */ __( 'ATTN: IT Department – SOME AUTO-UPDATES WENT WRONG!', 'my-plugin' );
Loading history...
11
    }
12
13
    return $email;
14
}
15
add_filter( 'auto_plugin_theme_update_email', 'tinywp_auto_plugin_theme_update_email', 10, 4 );
0 ignored issues
show
Bug introduced by
The function add_filter was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
/** @scrutinizer ignore-call */ 
16
add_filter( 'auto_plugin_theme_update_email', 'tinywp_auto_plugin_theme_update_email', 10, 4 );
Loading history...
16