| Conditions | 5 |
| Paths | 12 |
| Total Lines | 119 |
| 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 |
||
| 8 | function jetpack_beta_admin_page() { |
||
| 9 | ?> |
||
| 10 | |||
| 11 | <div class="jetpack-beta__master-head"> |
||
| 12 | <div class="jetpack-beta-container"> |
||
| 13 | <a class="jp-masthead__logo-link" href="<?php echo esc_url( Jetpack_Beta_Admin::settings_link() ); ?>"> |
||
| 14 | <svg className="jetpack-beta-logo" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="32" viewBox="0 0 118 32"> |
||
| 15 | <path fill="<?php echo esc_attr( JETPACK_GREEN ); ?>" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z" /> |
||
| 16 | <path d="M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z" /> |
||
| 17 | <path d="M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z" /> |
||
| 18 | <path d="M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z" /> |
||
| 19 | <path d="M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z" /> |
||
| 20 | <path d="M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z" /> |
||
| 21 | <path d="M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z" /> |
||
| 22 | <path d="M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z" /> |
||
| 23 | </svg> |
||
| 24 | <span>Beta Tester</span></a> |
||
| 25 | </div> |
||
| 26 | </div> |
||
| 27 | <div class="jetpack-beta-container" > |
||
| 28 | <?php Jetpack_Beta_Admin::show_needed_updates(); ?> |
||
| 29 | <?php if ( Jetpack_Beta::get_option() ) { ?> |
||
| 30 | <div class="dops-foldable-card is-expanded has-expanded-summary dops-card is-compact"> |
||
| 31 | <div class="dops-foldable-card__header has-border"> |
||
| 32 | <span class="dops-foldable-card__main"> |
||
| 33 | <div class="dops-foldable-card__header-text"> |
||
| 34 | <div class="dops-foldable-card__header-text">Currently Running </div> |
||
| 35 | </div> |
||
| 36 | </span> |
||
| 37 | <span class="dops-foldable-card__secondary"> |
||
| 38 | <?php Jetpack_Beta_Admin::show_toggle_emails(); ?> |
||
| 39 | <?php if ( ! Jetpack_Beta::is_on_tag() ) : ?> |
||
| 40 | <?php Jetpack_Beta_Admin::show_toggle_autoupdates(); ?> |
||
| 41 | <?php endif; ?> |
||
| 42 | </span> |
||
| 43 | </div> |
||
| 44 | <div class="dops-foldable-card__content"> |
||
| 45 | <p><?php echo wp_kses_post( Jetpack_Beta::get_jetpack_plugin_pretty_version() ); ?> |
||
| 46 | | <?php echo wp_kses_post( Jetpack_Beta::get_jetpack_plugin_version() ); ?></p> |
||
| 47 | </div> |
||
| 48 | </div> |
||
| 49 | <div class="dops-foldable-card has-expanded-summary dops-card"> |
||
| 50 | <div class="dops-foldable-card__header has-border"> |
||
| 51 | <span class="dops-foldable-card__main"> |
||
| 52 | <div class="dops-foldable-card__header-text"> |
||
| 53 | <div class="dops-foldable-card__header-text"><?php esc_html_e( 'Found a bug?', 'jetpack-beta' ); ?></div> |
||
| 54 | </div> |
||
| 55 | </span> |
||
| 56 | <span class="dops-foldable-card__secondary" > |
||
| 57 | <span class="dops-foldable-card__summary"> |
||
| 58 | <a |
||
| 59 | type="button" |
||
| 60 | href="<?php echo esc_url( JETPACK_BETA_REPORT_URL ); ?>" |
||
| 61 | class="is-primary jp-form-button dops-button is-primary is-compact jptracks" |
||
| 62 | data-jptracks-name="jetpack_beta_submit_report" |
||
| 63 | data-jptracks-prop="<?php echo esc_attr( Jetpack_Beta::get_jetpack_plugin_version() ); ?>" |
||
| 64 | > |
||
| 65 | <?php esc_html_e( 'Report it!', 'jetpack-beta' ); ?> |
||
| 66 | </a> |
||
| 67 | </span> |
||
| 68 | </span> |
||
| 69 | </div> |
||
| 70 | </div> |
||
| 71 | |||
| 72 | <?php |
||
| 73 | } else { |
||
| 74 | Jetpack_Beta_Admin::start_notice(); |
||
| 75 | } |
||
| 76 | ?> |
||
| 77 | <div class="jetpack-beta__wrap"> |
||
| 78 | <?php |
||
| 79 | Jetpack_Beta_Admin::show_stable_branch(); |
||
| 80 | Jetpack_Beta_Admin::show_branch( __( 'Release Candidate', 'jetpack-beta' ), 'rc', null, 'rc' ); |
||
| 81 | Jetpack_Beta_Admin::show_branch( __( 'Bleeding Edge', 'jetpack-beta' ), 'master', null, 'master' ); |
||
| 82 | Jetpack_Beta_Admin::show_search_prs(); |
||
| 83 | Jetpack_Beta_Admin::show_branches( 'pr' ); |
||
| 84 | Jetpack_Beta_Admin::show_search_org_tags(); |
||
| 85 | Jetpack_Beta_Admin::show_tags( 'tags' ); |
||
| 86 | ?> |
||
| 87 | </div> |
||
| 88 | |||
| 89 | <?php |
||
| 90 | $to_test = Jetpack_Beta_Admin::to_test_content(); |
||
| 91 | if ( $to_test ) { |
||
| 92 | ?> |
||
| 93 | <div class="dops-foldable-card is-expanded has-expanded-summary dops-card is-compact"> |
||
| 94 | <div class="dops-foldable-card__header has-border"> |
||
| 95 | <span class="dops-foldable-card__main"> |
||
| 96 | <div class="dops-foldable-card__header-text"> |
||
| 97 | <div class="dops-foldable-card__header-text"><?php esc_html_e( 'To Test', 'jetpack-beta' ); ?></div> |
||
| 98 | </div> |
||
| 99 | </span> |
||
| 100 | </div> |
||
| 101 | <div class="dops-foldable-card__content"> |
||
| 102 | <?php echo wp_kses_post( $to_test ); ?> |
||
| 103 | </div> |
||
| 104 | </div> |
||
| 105 | <?php } ?> |
||
| 106 | |||
| 107 | <?php |
||
| 108 | $what_changed = Jetpack_Beta::what_changed(); |
||
| 109 | if ( $what_changed ) { |
||
|
|
|||
| 110 | ?> |
||
| 111 | <div class="dops-foldable-card is-expanded has-expanded-summary dops-card is-compact"> |
||
| 112 | <div class="dops-foldable-card__header has-border"> |
||
| 113 | <span class="dops-foldable-card__main"> |
||
| 114 | <div class="dops-foldable-card__header-text"> |
||
| 115 | <div class="dops-foldable-card__header-text"><?php esc_html_e( 'What changed', 'jetpack-beta' ); ?></div> |
||
| 116 | </div> |
||
| 117 | </span> |
||
| 118 | </div> |
||
| 119 | <div class="dops-foldable-card__content"> |
||
| 120 | <?php echo esc_html( Jetpack_Beta_Admin::render_markdown( $what_changed ) ); ?> |
||
| 121 | </div> |
||
| 122 | </div> |
||
| 123 | <?php } ?> |
||
| 124 | </div> |
||
| 125 | <?php |
||
| 126 | } |
||
| 127 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: