Conditions | 1 |
Paths | 1 |
Total Lines | 84 |
Code Lines | 52 |
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 |
||
209 | function render_notice_second_step() { ?> |
||
210 | <div class="jp-idc-notice__second-step"> |
||
211 | <div class="jp-idc-notice__content-header"> |
||
212 | <h3 class="jp-idc-notice__content-header__lead"> |
||
213 | <?php |
||
214 | printf( |
||
215 | esc_html__( |
||
216 | 'Is %1$s the new home of %2$s?', |
||
217 | 'jetpack' |
||
218 | ), |
||
219 | untrailingslashit( Jetpack::normalize_url_protocol_agnostic( get_home_url() ) ), |
||
220 | untrailingslashit( Jetpack::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) ) |
||
221 | ) |
||
222 | ?> |
||
223 | </h3> |
||
224 | </div> |
||
225 | |||
226 | <div class="jp-idc-notice__actions"> |
||
227 | <div class="jp-idc-notice__action"> |
||
228 | <p class="jp-idc-notice__action__explanation"> |
||
229 | <?php |
||
230 | echo wp_kses( |
||
231 | sprintf( |
||
232 | __( |
||
233 | 'Yes. <a href="%1$s">%2$s</a> is replacing <a href="%3$s">%4$s</a>. I would like to |
||
234 | migrate my stats and subscribers from <a href="%3$s">%4$s</a> to <a href="%1$s">%2$s</a>.', |
||
235 | 'jetpack' |
||
236 | ), |
||
237 | esc_url( get_home_url() ), |
||
238 | self::prepare_url_for_display( get_home_url() ), |
||
239 | esc_url( self::$wpcom_home_url ), |
||
240 | untrailingslashit( Jetpack::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) ) |
||
241 | ), |
||
242 | array( 'a' => array( 'href' => array() ) ) |
||
243 | ); |
||
244 | ?> |
||
245 | </p> |
||
246 | <button id="jp-idc-migrate-action" class="dops-button"> |
||
247 | <?php esc_html_e( 'Migrate stats & and Subscribers' ); ?> |
||
248 | </button> |
||
249 | </div> |
||
250 | |||
251 | <div class="jp-idc-notice__action"> |
||
252 | <p class="jp-idc-notice__action__explanation"> |
||
253 | <?php |
||
254 | echo wp_kses( |
||
255 | sprintf( |
||
256 | __( |
||
257 | 'No. <a href="%1$s">%2$s</a> is a new and different website that\'s separate from |
||
258 | <a href="%3$s">%4$s</a>. It requires a new connection to WordPress.com for new stats and subscribers.', |
||
259 | 'jetpack' |
||
260 | ), |
||
261 | esc_url( get_home_url() ), |
||
262 | self::prepare_url_for_display( get_home_url() ), |
||
263 | esc_url( self::$wpcom_home_url ), |
||
264 | untrailingslashit( Jetpack::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) ) |
||
265 | ), |
||
266 | array( 'a' => array( 'href' => array() ) ) |
||
267 | ); |
||
268 | ?> |
||
269 | </p> |
||
270 | <button id="jp-idc-reconnect-site-action" class="dops-button"> |
||
271 | <?php esc_html_e( 'Start fresh & create new connection' ); ?> |
||
272 | </button> |
||
273 | </div> |
||
274 | |||
275 | </div> |
||
276 | |||
277 | <p class="jp-idc-notice__unsure-prompt"> |
||
278 | <?php |
||
279 | echo wp_kses( |
||
280 | sprintf( |
||
281 | __( |
||
282 | 'Unsure what to do? <a href="%1$s">Read more about Jetpack Safe Mode</a>', |
||
283 | 'jetpack' |
||
284 | ), |
||
285 | esc_url( self::SAFE_MODE_DOC_LINK ) |
||
286 | ), |
||
287 | array( 'a' => array( 'href' => array() ) ) |
||
288 | ); |
||
289 | ?> |
||
290 | </p> |
||
291 | </div> |
||
292 | <?php } |
||
293 | } |
||
296 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.