| Conditions | 1 |
| Paths | 1 |
| Total Lines | 124 |
| 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 |
||
| 33 | function __construct() { |
||
| 34 | parent::__construct( |
||
| 35 | 'widget_mailchimp_subscriber_popup', |
||
| 36 | /** This filter is documented in modules/widgets/facebook-likebox.php */ |
||
| 37 | apply_filters( 'jetpack_widget_name', __( 'MailChimp Subscriber Popup', 'jetpack' ) ), |
||
| 38 | array( |
||
| 39 | 'classname' => 'widget_mailchimp_subscriber_popup', |
||
| 40 | 'description' => __( 'Allows displaying a popup subscription form to visitors.', 'jetpack' ), |
||
| 41 | 'customize_selective_refresh' => true, |
||
| 42 | ) |
||
| 43 | ); |
||
| 44 | |||
| 45 | $this->form_sections = array( |
||
| 46 | array( |
||
| 47 | 'title' => esc_html__( 'Text Elements', 'jetpack' ), |
||
| 48 | 'fields' => array( |
||
| 49 | array( |
||
| 50 | 'title' => esc_html__( 'Email Placeholder', 'jetpack' ), |
||
| 51 | 'id' => 'jetpack_mailchimp_email', |
||
| 52 | 'placeholder' => esc_html__( 'Enter your email', 'jetpack' ), |
||
| 53 | 'type' => 'text', |
||
| 54 | ), |
||
| 55 | ), |
||
| 56 | ), |
||
| 57 | |||
| 58 | array( |
||
| 59 | 'title' => esc_html__( 'Notifications', 'jetpack' ), |
||
| 60 | 'fields' => array( |
||
| 61 | array( |
||
| 62 | 'title' => esc_html__( 'Processing', 'jetpack' ), |
||
| 63 | 'id' => 'jetpack_mailchimp_processing_text', |
||
| 64 | 'placeholder' => esc_html__( 'Processing', 'jetpack' ), |
||
| 65 | 'type' => 'text', |
||
| 66 | ), |
||
| 67 | |||
| 68 | array( |
||
| 69 | 'title' => esc_html__( 'Success text', 'jetpack' ), |
||
| 70 | 'id' => 'jetpack_mailchimp_success_text', |
||
| 71 | 'placeholder' => esc_html__( 'Success! You\'re on the list.', 'jetpack' ), |
||
| 72 | 'type' => 'text', |
||
| 73 | ), |
||
| 74 | |||
| 75 | array( |
||
| 76 | 'title' => esc_html__( 'Error text', 'jetpack' ), |
||
| 77 | 'id' => 'jetpack_mailchimp_error_text', |
||
| 78 | 'placeholder' => esc_html__( 'Whoops! There was an error and we couldn\'t process your subscription. Please reload the page and try again.', 'jetpack' ), |
||
| 79 | 'type' => 'text', |
||
| 80 | ), |
||
| 81 | ), |
||
| 82 | ), |
||
| 83 | |||
| 84 | array( |
||
| 85 | 'title' => esc_html__( 'Mailchimp Groups', 'jetpack' ), |
||
| 86 | 'fields' => array( |
||
| 87 | array( |
||
| 88 | 'type' => 'groups', |
||
| 89 | ), |
||
| 90 | ), |
||
| 91 | ), |
||
| 92 | |||
| 93 | array( |
||
| 94 | 'title' => esc_html__( 'Signup Location Tracking', 'jetpack' ), |
||
| 95 | 'fields' => array( |
||
| 96 | array( |
||
| 97 | 'title' => esc_html__( 'Signup Field Tag', 'jetpack' ), |
||
| 98 | 'id' => 'jetpack_mailchimp_signup_tag', |
||
| 99 | 'placeholder' => esc_html__( 'SIGNUP', 'jetpack' ), |
||
| 100 | 'type' => 'text', |
||
| 101 | ), |
||
| 102 | |||
| 103 | array( |
||
| 104 | 'title' => esc_html__( 'Signup Field Value', 'jetpack' ), |
||
| 105 | 'id' => 'jetpack_mailchimp_signup_value', |
||
| 106 | 'placeholder' => esc_html__( 'website', 'jetpack' ), |
||
| 107 | 'type' => 'text', |
||
| 108 | ), |
||
| 109 | ), |
||
| 110 | 'extra_content' => array( |
||
| 111 | 'text' => esc_html__( 'Learn about signup location tracking(opens in a new tab)', 'jetpack' ), |
||
| 112 | 'link' => 'https://mailchimp.com/help/determine-webpage-signup-location/', |
||
| 113 | 'type' => 'link', |
||
| 114 | ), |
||
| 115 | ), |
||
| 116 | |||
| 117 | array( |
||
| 118 | 'title' => esc_html__( 'Mailchimp Groups', 'jetpack' ), |
||
| 119 | 'extra_content' => array( |
||
| 120 | 'text' => esc_html__( 'Manage Connection', 'jetpack' ), |
||
| 121 | 'link' => 'https://jetpack.com/redirect?source=calypso-marketing-connections&site=[site_url]&query=mailchimp', |
||
| 122 | 'type' => 'link', |
||
| 123 | ), |
||
| 124 | ), |
||
| 125 | |||
| 126 | array( |
||
| 127 | 'title' => esc_html__( 'Button Color Settings', 'jetpack' ), |
||
| 128 | 'fields' => array( |
||
| 129 | array( |
||
| 130 | 'id' => 'jetpack_mailchimp_button_color', |
||
| 131 | 'type' => 'color', |
||
| 132 | ), |
||
| 133 | |||
| 134 | array( |
||
| 135 | 'id' => 'jetpack_mailchimp_button_text_color', |
||
| 136 | 'type' => 'color', |
||
| 137 | ), |
||
| 138 | ), |
||
| 139 | ), |
||
| 140 | |||
| 141 | array( |
||
| 142 | 'title' => esc_html__( 'Advanced', 'jetpack' ), |
||
| 143 | 'fields' => array( |
||
| 144 | array( |
||
| 145 | 'title' => esc_html__( 'Additional CSS class(es)', 'jetpack' ), |
||
| 146 | 'id' => 'jetpack_mailchimp_css_class', |
||
| 147 | 'placeholder' => '', |
||
| 148 | 'help_text' => esc_html__( 'Separate multiple classes with spaces.', 'jetpack' ), |
||
| 149 | 'type' => 'text', |
||
| 150 | ), |
||
| 151 | ), |
||
| 152 | ), |
||
| 153 | ); |
||
| 154 | |||
| 155 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); |
||
| 156 | } |
||
| 157 | |||
| 337 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: