| 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 |
||
| 136 | function render_notice_first_step() { ?> |
||
| 137 | <div class="jp-idc-notice__first-step"> |
||
| 138 | <div class="jp-idc-notice__content-header"> |
||
| 139 | <h3 class="jp-idc-notice__content-header__lead"> |
||
| 140 | <?php |
||
| 141 | echo wp_kses( |
||
| 142 | sprintf( |
||
| 143 | __( |
||
| 144 | '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>.', |
||
| 145 | 'jetpack' |
||
| 146 | ), |
||
| 147 | esc_url( self::SAFE_MODE_DOC_LINK ), |
||
| 148 | esc_url( untrailingslashit( self::$wpcom_home_url ) ) |
||
| 149 | ), |
||
| 150 | array( 'a' => array( 'href' => array() ) ) |
||
| 151 | ); |
||
| 152 | ?> |
||
| 153 | </h3> |
||
| 154 | |||
| 155 | <p class="jp-idc-notice__content-header__explanation"> |
||
| 156 | <?php |
||
| 157 | echo wp_kses( |
||
| 158 | sprintf( |
||
| 159 | __( |
||
| 160 | 'Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or <a href="%1$s">learn |
||
| 161 | more about Safe Mode</a>.', |
||
| 162 | 'jetpack' |
||
| 163 | ), |
||
| 164 | esc_url( self::SAFE_MODE_DOC_LINK ) |
||
| 165 | ), |
||
| 166 | array( 'a' => array( 'href' => array() ) ) |
||
| 167 | ); |
||
| 168 | ?> |
||
| 169 | </p> |
||
| 170 | </div> |
||
| 171 | |||
| 172 | <div class="jp-idc-notice__actions"> |
||
| 173 | <div class="jp-idc-notice__action"> |
||
| 174 | <p class="jp-idc-notice__action__explanation"> |
||
| 175 | <?php |
||
| 176 | echo wp_kses( |
||
| 177 | sprintf( |
||
| 178 | __( |
||
| 179 | 'Is this website a temporary duplicate of <a href="%1$s">%1$s</a> for the purposes |
||
| 180 | of testing, staging or development? If so, we recommend keeping it in Safe Mode.', |
||
| 181 | 'jetpack' |
||
| 182 | ), |
||
| 183 | esc_url( untrailingslashit( self::$wpcom_home_url ) ) |
||
| 184 | ), |
||
| 185 | array( 'a' => array( 'href' => array() ) ) |
||
| 186 | ); |
||
| 187 | ?> |
||
| 188 | </p> |
||
| 189 | <button id="jp-idc-confirm-safe-mode-action" class="dops-button"> |
||
| 190 | <?php esc_html_e( 'Confirm Safe Mode' ); ?> |
||
| 191 | </button> |
||
| 192 | </div> |
||
| 193 | |||
| 194 | <div class="jp-idc-notice__action"> |
||
| 195 | <p class="jp-idc-notice__action__explanation"> |
||
| 196 | <?php |
||
| 197 | echo wp_kses( |
||
| 198 | sprintf( |
||
| 199 | __( |
||
| 200 | 'If this is a separate and new website, or the new home of <a href="%1$s">%1$s</a>, |
||
| 201 | we recommend turning Safe Mode off, and re-establishing your connection to WordPress.com.', |
||
| 202 | 'jetpack' |
||
| 203 | ), |
||
| 204 | esc_url( untrailingslashit( self::$wpcom_home_url ) ) |
||
| 205 | ), |
||
| 206 | array( 'a' => array( 'href' => array() ) ) |
||
| 207 | ); |
||
| 208 | ?> |
||
| 209 | </p> |
||
| 210 | <button id="jp-idc-fix-connection-action" class="dops-button"> |
||
| 211 | <?php esc_html_e( "Fix Jetpack's Connection" ); ?> |
||
| 212 | </button> |
||
| 213 | </div> |
||
| 214 | </div> |
||
| 215 | </div> |
||
| 216 | <?php } |
||
| 217 | |||
| 279 |
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.