Conditions | 1 |
Paths | 1 |
Total Lines | 57 |
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 |
||
189 | public function render_banner() { |
||
190 | $jetpack_logo = new Jetpack_Logo(); |
||
191 | $site_name = get_bloginfo( 'name' ); |
||
192 | ?> |
||
193 | <div id="jp-recommendations-banner-main" class="jp-recommendations-banner-main"> |
||
194 | <div class="jp-recommendations-banner__content"> |
||
195 | <div class="jp-recommendations-banner__logo"> |
||
196 | <?php |
||
197 | echo $jetpack_logo->get_jp_emblem_larger(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
||
198 | ?> |
||
199 | </div> |
||
200 | <h1 class="jp-recommendations-banner__question"> |
||
201 | <?php |
||
202 | /* translators: placeholder is the name of the website */ |
||
203 | echo sprintf( esc_html__( 'What type of site is %s?', 'jetpack' ), esc_html( $site_name ) ); |
||
204 | ?> |
||
205 | </h1> |
||
206 | <p class="jp-recommendations-banner__description"> |
||
207 | <?php esc_html_e( 'This assistant will help you get the most from Jetpack. Tell us more about your goals and we’ll recommend relevant features to help you succeed.', 'jetpack' ); ?> |
||
208 | </p> |
||
209 | <div class="jp-recommendations-banner__answer"> |
||
210 | <form id="jp-recommendations-banner__form" class="jp-recommendations-banner__form"> |
||
211 | <div class="jp-recommendations-banner__checkboxes"> |
||
212 | <?php $this->render_checkbox( 'personal', __( 'Personal', 'jetpack' ) ); ?> |
||
213 | <?php $this->render_checkbox( 'business', __( 'Business', 'jetpack' ) ); ?> |
||
214 | <?php $this->render_checkbox( 'store', __( 'Store', 'jetpack' ) ); ?> |
||
215 | <?php $this->render_checkbox( 'other', __( 'Other', 'jetpack' ) ); ?> |
||
216 | </div> |
||
217 | </form> |
||
218 | <a id="jp-recommendations-banner__continue-button" class="jp-recommendations-banner__continue-button"> |
||
219 | <?php esc_html_e( 'Continue', 'jetpack' ); ?> |
||
220 | </a> |
||
221 | <div class="jp-recommendations-banner__continue-description"> |
||
222 | <?php esc_html_e( 'The following Jetpack recommendations are available to you later in the Jetpack dashboard.', 'jetpack' ); ?> |
||
223 | </div> |
||
224 | </div> |
||
225 | </div> |
||
226 | <div class="jp-recommendations-banner__illustration-container"> |
||
227 | <div id="jp-recommendations-banner__notice-dismiss" class="jp-recommendations-banner__notice-dismiss"> |
||
228 | <svg class="jp-recommendations-banner__svg-dismiss" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
||
229 | <mask id="jp-dismiss-mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="2" y="2" width="21" height="20"> |
||
230 | <path fill-rule="evenodd" clip-rule="evenodd" d="M12.5232 2C7.02034 2 2.57227 6.47 2.57227 12C2.57227 17.53 7.02034 22 12.5232 22C18.0261 22 22.4742 17.53 22.4742 12C22.4742 6.47 18.0261 2 12.5232 2ZM15.1005 8L12.5232 10.59L9.94591 8L8.54283 9.41L11.1201 12L8.54283 14.59L9.94591 16L12.5232 13.41L15.1005 16L16.5036 14.59L13.9263 12L16.5036 9.41L15.1005 8ZM4.56245 12C4.56245 16.41 8.13484 20 12.5232 20C16.9116 20 20.484 16.41 20.484 12C20.484 7.59 16.9116 4 12.5232 4C8.13484 4 4.56245 7.59 4.56245 12Z" /> |
||
231 | </mask><g mask="url(#jp-dismiss-mask0)"><rect x="0.582031" width="23.8823" height="24" /></g></svg> |
||
232 | <span><?php esc_attr_e( 'Dismiss', 'jetpack' ); ?></span> |
||
233 | </div> |
||
234 | <img |
||
235 | src="<?php echo esc_url( plugins_url( 'images/recommendations/background.svg', JETPACK__PLUGIN_FILE ), 'jetpack' ); ?>" |
||
236 | class="jp-recommendations-banner__illustration-background" |
||
237 | /> |
||
238 | <img |
||
239 | src="<?php echo esc_url( plugins_url( 'images/recommendations/site-type-illustration.jpg', JETPACK__PLUGIN_FILE ), 'jetpack' ); ?>" |
||
240 | class="jp-recommendations-banner__illustration-foreground" |
||
241 | /> |
||
242 | </div> |
||
243 | </div> |
||
244 | <?php |
||
245 | } |
||
246 | |||
264 |
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: