| Conditions | 8 |
| Paths | 48 |
| Total Lines | 109 |
| Code Lines | 77 |
| 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 |
||
| 129 | public function init() { |
||
| 130 | // The Weekdays |
||
| 131 | $this->weekday[0] = /* translators: weekday */ __('Sunday'); |
||
| 132 | $this->weekday[1] = /* translators: weekday */ __('Monday'); |
||
| 133 | $this->weekday[2] = /* translators: weekday */ __('Tuesday'); |
||
| 134 | $this->weekday[3] = /* translators: weekday */ __('Wednesday'); |
||
| 135 | $this->weekday[4] = /* translators: weekday */ __('Thursday'); |
||
| 136 | $this->weekday[5] = /* translators: weekday */ __('Friday'); |
||
| 137 | $this->weekday[6] = /* translators: weekday */ __('Saturday'); |
||
| 138 | |||
| 139 | // The first letter of each day. |
||
| 140 | $this->weekday_initial[ __( 'Sunday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'S', 'Sunday initial' ); |
||
| 141 | $this->weekday_initial[ __( 'Monday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'M', 'Monday initial' ); |
||
| 142 | $this->weekday_initial[ __( 'Tuesday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'T', 'Tuesday initial' ); |
||
| 143 | $this->weekday_initial[ __( 'Wednesday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'W', 'Wednesday initial' ); |
||
| 144 | $this->weekday_initial[ __( 'Thursday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'T', 'Thursday initial' ); |
||
| 145 | $this->weekday_initial[ __( 'Friday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'F', 'Friday initial' ); |
||
| 146 | $this->weekday_initial[ __( 'Saturday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'S', 'Saturday initial' ); |
||
| 147 | |||
| 148 | // Abbreviations for each day. |
||
| 149 | $this->weekday_abbrev[__('Sunday')] = /* translators: three-letter abbreviation of the weekday */ __('Sun'); |
||
| 150 | $this->weekday_abbrev[__('Monday')] = /* translators: three-letter abbreviation of the weekday */ __('Mon'); |
||
| 151 | $this->weekday_abbrev[__('Tuesday')] = /* translators: three-letter abbreviation of the weekday */ __('Tue'); |
||
| 152 | $this->weekday_abbrev[__('Wednesday')] = /* translators: three-letter abbreviation of the weekday */ __('Wed'); |
||
| 153 | $this->weekday_abbrev[__('Thursday')] = /* translators: three-letter abbreviation of the weekday */ __('Thu'); |
||
| 154 | $this->weekday_abbrev[__('Friday')] = /* translators: three-letter abbreviation of the weekday */ __('Fri'); |
||
| 155 | $this->weekday_abbrev[__('Saturday')] = /* translators: three-letter abbreviation of the weekday */ __('Sat'); |
||
| 156 | |||
| 157 | // The Months |
||
| 158 | $this->month['01'] = /* translators: month name */ __( 'January' ); |
||
| 159 | $this->month['02'] = /* translators: month name */ __( 'February' ); |
||
| 160 | $this->month['03'] = /* translators: month name */ __( 'March' ); |
||
| 161 | $this->month['04'] = /* translators: month name */ __( 'April' ); |
||
| 162 | $this->month['05'] = /* translators: month name */ __( 'May' ); |
||
| 163 | $this->month['06'] = /* translators: month name */ __( 'June' ); |
||
| 164 | $this->month['07'] = /* translators: month name */ __( 'July' ); |
||
| 165 | $this->month['08'] = /* translators: month name */ __( 'August' ); |
||
| 166 | $this->month['09'] = /* translators: month name */ __( 'September' ); |
||
| 167 | $this->month['10'] = /* translators: month name */ __( 'October' ); |
||
| 168 | $this->month['11'] = /* translators: month name */ __( 'November' ); |
||
| 169 | $this->month['12'] = /* translators: month name */ __( 'December' ); |
||
| 170 | |||
| 171 | // The Months, genitive |
||
| 172 | $this->month_genitive['01'] = /* translators: month name, genitive */ _x( 'January', 'genitive' ); |
||
| 173 | $this->month_genitive['02'] = /* translators: month name, genitive */ _x( 'February', 'genitive' ); |
||
| 174 | $this->month_genitive['03'] = /* translators: month name, genitive */ _x( 'March', 'genitive' ); |
||
| 175 | $this->month_genitive['04'] = /* translators: month name, genitive */ _x( 'April', 'genitive' ); |
||
| 176 | $this->month_genitive['05'] = /* translators: month name, genitive */ _x( 'May', 'genitive' ); |
||
| 177 | $this->month_genitive['06'] = /* translators: month name, genitive */ _x( 'June', 'genitive' ); |
||
| 178 | $this->month_genitive['07'] = /* translators: month name, genitive */ _x( 'July', 'genitive' ); |
||
| 179 | $this->month_genitive['08'] = /* translators: month name, genitive */ _x( 'August', 'genitive' ); |
||
| 180 | $this->month_genitive['09'] = /* translators: month name, genitive */ _x( 'September', 'genitive' ); |
||
| 181 | $this->month_genitive['10'] = /* translators: month name, genitive */ _x( 'October', 'genitive' ); |
||
| 182 | $this->month_genitive['11'] = /* translators: month name, genitive */ _x( 'November', 'genitive' ); |
||
| 183 | $this->month_genitive['12'] = /* translators: month name, genitive */ _x( 'December', 'genitive' ); |
||
| 184 | |||
| 185 | // Abbreviations for each month. |
||
| 186 | $this->month_abbrev[ __( 'January' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Jan', 'January abbreviation' ); |
||
| 187 | $this->month_abbrev[ __( 'February' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Feb', 'February abbreviation' ); |
||
| 188 | $this->month_abbrev[ __( 'March' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Mar', 'March abbreviation' ); |
||
| 189 | $this->month_abbrev[ __( 'April' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Apr', 'April abbreviation' ); |
||
| 190 | $this->month_abbrev[ __( 'May' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'May', 'May abbreviation' ); |
||
| 191 | $this->month_abbrev[ __( 'June' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Jun', 'June abbreviation' ); |
||
| 192 | $this->month_abbrev[ __( 'July' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Jul', 'July abbreviation' ); |
||
| 193 | $this->month_abbrev[ __( 'August' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Aug', 'August abbreviation' ); |
||
| 194 | $this->month_abbrev[ __( 'September' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Sep', 'September abbreviation' ); |
||
| 195 | $this->month_abbrev[ __( 'October' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Oct', 'October abbreviation' ); |
||
| 196 | $this->month_abbrev[ __( 'November' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Nov', 'November abbreviation' ); |
||
| 197 | $this->month_abbrev[ __( 'December' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Dec', 'December abbreviation' ); |
||
| 198 | |||
| 199 | // The Meridiems |
||
| 200 | $this->meridiem['am'] = __('am'); |
||
| 201 | $this->meridiem['pm'] = __('pm'); |
||
| 202 | $this->meridiem['AM'] = __('AM'); |
||
| 203 | $this->meridiem['PM'] = __('PM'); |
||
| 204 | |||
| 205 | // Numbers formatting |
||
| 206 | // See https://secure.php.net/number_format |
||
| 207 | |||
| 208 | /* translators: $thousands_sep argument for https://secure.php.net/number_format, default is , */ |
||
| 209 | $thousands_sep = __( 'number_format_thousands_sep' ); |
||
| 210 | |||
| 211 | if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) { |
||
| 212 | // Replace space with a non-breaking space to avoid wrapping. |
||
| 213 | $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); |
||
| 214 | } else { |
||
| 215 | // PHP < 5.4.0 does not support multiple bytes in thousands separator. |
||
| 216 | $thousands_sep = str_replace( array( ' ', ' ' ), ' ', $thousands_sep ); |
||
| 217 | } |
||
| 218 | |||
| 219 | $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep; |
||
| 220 | |||
| 221 | /* translators: $dec_point argument for https://secure.php.net/number_format, default is . */ |
||
| 222 | $decimal_point = __( 'number_format_decimal_point' ); |
||
| 223 | |||
| 224 | $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point; |
||
| 225 | |||
| 226 | // Set text direction. |
||
| 227 | if ( isset( $GLOBALS['text_direction'] ) ) |
||
| 228 | $this->text_direction = $GLOBALS['text_direction']; |
||
| 229 | /* translators: 'rtl' or 'ltr'. This sets the text direction for WordPress. */ |
||
| 230 | elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) |
||
| 231 | $this->text_direction = 'rtl'; |
||
| 232 | |||
| 233 | if ( 'rtl' === $this->text_direction && strpos( get_bloginfo( 'version' ), '-src' ) ) { |
||
| 234 | $this->text_direction = 'ltr'; |
||
| 235 | add_action( 'all_admin_notices', array( $this, 'rtl_src_admin_notice' ) ); |
||
| 236 | } |
||
| 237 | } |
||
| 238 | |||
| 405 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.