| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| Code Lines | 48 |
| 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 |
||
| 116 | function render_notice_first_step() { ?> |
||
| 117 | <div class="jp-idc-notice__first-step"> |
||
| 118 | <div class="jp-idc-notice__content-header"> |
||
| 119 | <h3 class="jp-idc-notice__content-header__lead"> |
||
| 120 | <?php |
||
| 121 | echo wp_kses( |
||
| 122 | sprintf( |
||
| 123 | __( |
||
| 124 | 'Jetpack has been placed into <a href="%1$s">Safe mode</a> because we noticed this is an exact copy of <a href="%2$s">%2$s</a>.', |
||
| 125 | 'jetpack' |
||
| 126 | ), |
||
| 127 | esc_url( self::SAFE_MODE_DOC_LINK ), |
||
| 128 | esc_url( untrailingslashit( self::$wpcom_home_url ) ) |
||
| 129 | ), |
||
| 130 | array( 'a' => array( 'href' => array() ) ) |
||
| 131 | ); |
||
| 132 | ?> |
||
| 133 | </h3> |
||
| 134 | |||
| 135 | <p class="jp-idc-notice__content-header__explanation"> |
||
| 136 | <?php |
||
| 137 | echo wp_kses( |
||
| 138 | sprintf( |
||
| 139 | __( |
||
| 140 | 'Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or <a href="%1$s">learn |
||
| 141 | more about Safe Mode</a>.', |
||
| 142 | 'jetpack' |
||
| 143 | ), |
||
| 144 | esc_url( self::SAFE_MODE_DOC_LINK ) |
||
| 145 | ), |
||
| 146 | array( 'a' => array( 'href' => array() ) ) |
||
| 147 | ); |
||
| 148 | ?> |
||
| 149 | </p> |
||
| 150 | </div> |
||
| 151 | |||
| 152 | <div class="jp-idc-notice__actions"> |
||
| 153 | <div class="jp-idc-notice__action"> |
||
| 154 | <p class="jp-idc-notice__action__explanation"> |
||
| 155 | <?php |
||
| 156 | echo wp_kses( |
||
| 157 | sprintf( |
||
| 158 | __( |
||
| 159 | 'Is this website a temporary duplicate of <a href="%1$s">%1$s</a> for the purposes |
||
| 160 | of testing, staging or development? If so, we recommend keeping it in Safe Mode.', |
||
| 161 | 'jetpack' |
||
| 162 | ), |
||
| 163 | esc_url( untrailingslashit( self::$wpcom_home_url ) ) |
||
| 164 | ), |
||
| 165 | array( 'a' => array( 'href' => array() ) ) |
||
| 166 | ); |
||
| 167 | ?> |
||
| 168 | </p> |
||
| 169 | <button id="jp-idc-confirm-safe-mode-action" class="dops-button"> |
||
| 170 | <?php esc_html_e( 'Confirm Safe Mode' ); ?> |
||
| 171 | </button> |
||
| 172 | </div> |
||
| 173 | |||
| 174 | <div class="jp-idc-notice__action"> |
||
| 175 | <p class="jp-idc-notice__action__explanation"> |
||
| 176 | <?php |
||
| 177 | echo wp_kses( |
||
| 178 | sprintf( |
||
| 179 | __( |
||
| 180 | 'If this is a separate and new website, or the new home of <a href="%1$s">%1$s</a>, |
||
| 181 | we recommend turning Safe Mode off, and re-establishing your connection to WordPress.com.', |
||
| 182 | 'jetpack' |
||
| 183 | ), |
||
| 184 | esc_url( untrailingslashit( self::$wpcom_home_url ) ) |
||
| 185 | ), |
||
| 186 | array( 'a' => array( 'href' => array() ) ) |
||
| 187 | ); |
||
| 188 | ?> |
||
| 189 | </p> |
||
| 190 | <button id="jp-idc-fix-connection-action" class="dops-button"> |
||
| 191 | <?php esc_html_e( "Fix Jetpack's Connection" ); ?> |
||
| 192 | </button> |
||
| 193 | </div> |
||
| 194 | </div> |
||
| 195 | </div> |
||
| 196 | <?php } |
||
| 197 | |||
| 259 |
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.