Conditions | 3 |
Paths | 3 |
Total Lines | 115 |
Code Lines | 98 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
261 | public function ayecode_connect_install_notice() { |
||
262 | if ( $this->maybe_show() ) { |
||
263 | $connect_title_string = $this->strings['connect_title']; |
||
264 | $connect_external_string = $this->strings['connect_external']; |
||
265 | $connect_string = $this->strings['connect']; |
||
266 | $connect_button_string = $this->strings['connect_button']; |
||
267 | $connecting_button_string = $this->strings['connecting_button']; |
||
268 | ?> |
||
269 | <div class="notice notice-info acch-notice"> |
||
270 | <span class="acch-float-left"> |
||
271 | <svg width="61px" height="61px" viewBox="0 0 61 61" version="1.1" |
||
272 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
||
273 | <defs> |
||
274 | <polygon id="path-1" |
||
275 | points="4.70437018e-05 0.148846272 60.8504481 0.148846272 60.8504481 61 4.70437018e-05 61"></polygon> |
||
276 | </defs> |
||
277 | <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
||
278 | <g id="Group-6" transform="translate(-8.000000, -4.000000)"> |
||
279 | <g id="Group-5" transform="translate(8.000000, 4.000000)"> |
||
280 | <g id="Group-17"> |
||
281 | <mask id="mask-2" fill="white"> |
||
282 | <use xlink:href="#path-1"></use> |
||
283 | </mask> |
||
284 | <g id="Clip-16"></g> |
||
285 | <path |
||
286 | d="M60.8504481,30.5740468 C60.8504481,47.3793116 47.229101,61.0000314 30.4252476,61.0000314 C13.6215509,61.0000314 4.70437018e-05,47.3793116 4.70437018e-05,30.5740468 C4.70437018e-05,13.7711342 13.6215509,0.148846272 30.4252476,0.148846272 C47.229101,0.148846272 60.8504481,13.7711342 60.8504481,30.5740468" |
||
287 | id="Fill-15" fill="#4C96D7" mask="url(#mask-2)"></path> |
||
288 | </g> |
||
289 | <path |
||
290 | d="M7.34736527,20.4434788 C7.34736527,14.815441 10.231253,12 16,12 L16,16.2224505 C13.1153027,16.2224505 11.6736826,17.6294599 11.6736826,20.4434788 L11.6736826,26.7780236 C11.6736826,28.9016534 10.59182,30.310085 8.42858032,30.9988939 C10.5775721,31.7039788 11.6519871,33.1116203 11.6519871,35.2221344 L11.6519871,41.5566793 C11.6519871,44.3705401 13.0927976,45.7777075 15.9783045,45.7777075 L15.9783045,50 C10.2246148,50 7.34736527,47.184717 7.34736527,41.5566793 L7.34736527,35.2221344 C7.34736527,33.815283 5.89748795,33.1116203 3,33.1116203 L3,28.8883797 C5.89748795,28.8883797 7.34736527,28.185033 7.34736527,26.7780236 L7.34736527,20.4434788 Z" |
||
291 | id="Fill-18" fill="#FFFFFF"></path> |
||
292 | <path |
||
293 | d="M53.6524181,41.5551342 C53.6524181,47.1845707 50.7690344,50 45,50 L45,45.7775671 C47.8841934,45.7775671 49.3266948,44.3691413 49.3266948,41.5551342 L49.3266948,35.2221959 C49.3266948,33.0969947 50.4079637,31.689201 52.5719588,30.9989729 C50.4222123,30.2954711 49.3483914,28.8884675 49.3483914,26.77654 L49.3483914,20.4434437 C49.3483914,17.6281723 47.90589,16.2225909 45.021049,16.2225909 L45.021049,12 C50.7758348,12 53.6524181,14.8140072 53.6524181,20.4434437 L53.6524181,26.77654 C53.6524181,28.1835435 55.1023677,28.8884675 58,28.8884675 L58,33.1116905 C55.1023677,33.1116905 53.6524181,33.8151923 53.6524181,35.2221959 L53.6524181,41.5551342 Z" |
||
294 | id="Fill-20" fill="#FFFFFF"></path> |
||
295 | <path |
||
296 | d="M46.0272652,44 C48.1048141,44 48.9396754,43.2042837 48.9795214,41.1979284 L34.4844624,30.499526 L49,19.7867451 C48.9558678,17.7920822 48.1210065,17 46.0479025,17 L45.8064452,17 L30.9992856,27.9275105 L16.1929198,17 L15.9727348,17 C13.8943922,17 13.0596896,17.7958743 13.0206374,19.8023876 L27.5141088,30.499526 L13,41.2126229 C13.0434972,43.2071278 13.8781998,44 15.9513037,44 L16.1929198,44 L30.9992856,33.0718574 L45.8064452,44 L46.0272652,44 Z" |
||
297 | id="Fill-22" fill="#FFFFFF"></path> |
||
298 | </g> |
||
299 | </g> |
||
300 | </g> |
||
301 | </svg> |
||
302 | </span> |
||
303 | <span class="acch-float-left acch-text"> |
||
304 | <h3 class="acch-title"><?php echo esc_attr( $connect_title_string ); ?></h3> |
||
305 | <p> |
||
306 | <?php |
||
307 | echo $connect_string; |
||
308 | ?> |
||
309 | </p> |
||
310 | </span> |
||
311 | |||
312 | <span class="acch-float-left acch-button"> |
||
313 | <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" |
||
314 | class="button button-primary" |
||
315 | data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button> |
||
316 | </span> |
||
317 | |||
318 | </div> |
||
319 | |||
320 | <?php |
||
321 | // only include the popup HTML if needed. |
||
322 | if ( ! empty( $_REQUEST['external-connect-request'] ) ) { |
||
323 | ?> |
||
324 | <div id="ayecode-connect-helper-external-confirm" style="display:none;"> |
||
325 | <div class="noticex notice-info acch-notice" style="border: none;"> |
||
326 | <span class="acch-float-left"> |
||
327 | <svg width="61px" height="61px" viewBox="0 0 61 61" version="1.1" |
||
328 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
||
329 | <defs> |
||
330 | <polygon id="path-1" |
||
331 | points="4.70437018e-05 0.148846272 60.8504481 0.148846272 60.8504481 61 4.70437018e-05 61"></polygon> |
||
332 | </defs> |
||
333 | <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
||
334 | <g id="Group-6" transform="translate(-8.000000, -4.000000)"> |
||
335 | <g id="Group-5" transform="translate(8.000000, 4.000000)"> |
||
336 | <g id="Group-17"> |
||
337 | <mask id="mask-2" fill="white"> |
||
338 | <use xlink:href="#path-1"></use> |
||
339 | </mask> |
||
340 | <g id="Clip-16"></g> |
||
341 | <path |
||
342 | d="M60.8504481,30.5740468 C60.8504481,47.3793116 47.229101,61.0000314 30.4252476,61.0000314 C13.6215509,61.0000314 4.70437018e-05,47.3793116 4.70437018e-05,30.5740468 C4.70437018e-05,13.7711342 13.6215509,0.148846272 30.4252476,0.148846272 C47.229101,0.148846272 60.8504481,13.7711342 60.8504481,30.5740468" |
||
343 | id="Fill-15" fill="#4C96D7" mask="url(#mask-2)"></path> |
||
344 | </g> |
||
345 | <path |
||
346 | d="M7.34736527,20.4434788 C7.34736527,14.815441 10.231253,12 16,12 L16,16.2224505 C13.1153027,16.2224505 11.6736826,17.6294599 11.6736826,20.4434788 L11.6736826,26.7780236 C11.6736826,28.9016534 10.59182,30.310085 8.42858032,30.9988939 C10.5775721,31.7039788 11.6519871,33.1116203 11.6519871,35.2221344 L11.6519871,41.5566793 C11.6519871,44.3705401 13.0927976,45.7777075 15.9783045,45.7777075 L15.9783045,50 C10.2246148,50 7.34736527,47.184717 7.34736527,41.5566793 L7.34736527,35.2221344 C7.34736527,33.815283 5.89748795,33.1116203 3,33.1116203 L3,28.8883797 C5.89748795,28.8883797 7.34736527,28.185033 7.34736527,26.7780236 L7.34736527,20.4434788 Z" |
||
347 | id="Fill-18" fill="#FFFFFF"></path> |
||
348 | <path |
||
349 | d="M53.6524181,41.5551342 C53.6524181,47.1845707 50.7690344,50 45,50 L45,45.7775671 C47.8841934,45.7775671 49.3266948,44.3691413 49.3266948,41.5551342 L49.3266948,35.2221959 C49.3266948,33.0969947 50.4079637,31.689201 52.5719588,30.9989729 C50.4222123,30.2954711 49.3483914,28.8884675 49.3483914,26.77654 L49.3483914,20.4434437 C49.3483914,17.6281723 47.90589,16.2225909 45.021049,16.2225909 L45.021049,12 C50.7758348,12 53.6524181,14.8140072 53.6524181,20.4434437 L53.6524181,26.77654 C53.6524181,28.1835435 55.1023677,28.8884675 58,28.8884675 L58,33.1116905 C55.1023677,33.1116905 53.6524181,33.8151923 53.6524181,35.2221959 L53.6524181,41.5551342 Z" |
||
350 | id="Fill-20" fill="#FFFFFF"></path> |
||
351 | <path |
||
352 | d="M46.0272652,44 C48.1048141,44 48.9396754,43.2042837 48.9795214,41.1979284 L34.4844624,30.499526 L49,19.7867451 C48.9558678,17.7920822 48.1210065,17 46.0479025,17 L45.8064452,17 L30.9992856,27.9275105 L16.1929198,17 L15.9727348,17 C13.8943922,17 13.0596896,17.7958743 13.0206374,19.8023876 L27.5141088,30.499526 L13,41.2126229 C13.0434972,43.2071278 13.8781998,44 15.9513037,44 L16.1929198,44 L30.9992856,33.0718574 L45.8064452,44 L46.0272652,44 Z" |
||
353 | id="Fill-22" fill="#FFFFFF"></path> |
||
354 | </g> |
||
355 | </g> |
||
356 | </g> |
||
357 | </svg> |
||
358 | </span> |
||
359 | <span class="acch-float-left acch-text"> |
||
360 | <h3 class="acch-title"><?php echo esc_attr( $connect_external_string ); ?></h3> |
||
361 | </span> |
||
362 | |||
363 | <span class="acch-float-left acch-button"> |
||
364 | <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" |
||
365 | class="button button-primary" |
||
366 | data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button> |
||
367 | </span> |
||
368 | |||
369 | </div> |
||
370 | </div> |
||
371 | <?php |
||
372 | } |
||
373 | |||
374 | // add required scripts |
||
375 | $this->script(); |
||
376 | } |
||
497 |