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