| Total Complexity | 54 |
| Total Lines | 288 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Complex classes like WPInv_EUVat often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use WPInv_EUVat, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 12 | class WPInv_EUVat { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Retrieves an instance of this class. |
||
| 16 | * |
||
| 17 | * @deprecated |
||
| 18 | * @return WPInv_EUVat |
||
| 19 | */ |
||
| 20 | public static function get_instance() { |
||
| 21 | return new self(); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @deprecated |
||
| 26 | */ |
||
| 27 | public static function get_eu_states() { |
||
| 28 | return getpaid_get_eu_states(); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @deprecated |
||
| 33 | */ |
||
| 34 | public static function get_gst_countries() { |
||
| 35 | return getpaid_get_gst_states(); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @deprecated |
||
| 40 | */ |
||
| 41 | public static function is_eu_state( $country_code ) { |
||
| 42 | return getpaid_is_eu_state( $country_code ); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @deprecated |
||
| 47 | */ |
||
| 48 | public static function is_gst_country( $country_code ) { |
||
| 49 | return getpaid_is_gst_country( $country_code ); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @deprecated |
||
| 54 | */ |
||
| 55 | public static function vat_rates_settings() {} |
||
| 56 | |||
| 57 | /** |
||
| 58 | * |
||
| 59 | * @deprecated |
||
| 60 | */ |
||
| 61 | public static function vat_settings() {} |
||
| 62 | |||
| 63 | /** |
||
| 64 | * |
||
| 65 | * @deprecated |
||
| 66 | */ |
||
| 67 | public static function maxmind_folder() {} |
||
| 68 | |||
| 69 | /** |
||
| 70 | * |
||
| 71 | * @deprecated |
||
| 72 | */ |
||
| 73 | public static function geoip2_download_database() {} |
||
| 74 | |||
| 75 | /** |
||
| 76 | * |
||
| 77 | * @deprecated |
||
| 78 | */ |
||
| 79 | public static function geoip2_download_file() {} |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @deprecated |
||
| 83 | */ |
||
| 84 | public static function load_geoip2() {} |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @deprecated |
||
| 88 | */ |
||
| 89 | public static function geoip2_country_dbfile() {} |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @deprecated |
||
| 93 | */ |
||
| 94 | public static function geoip2_city_dbfile() {} |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @deprecated |
||
| 98 | */ |
||
| 99 | public static function geoip2_country_reader() {} |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @deprecated |
||
| 103 | */ |
||
| 104 | public static function geoip2_city_reader() {} |
||
| 105 | |||
| 106 | /** |
||
| 107 | * @deprecated |
||
| 108 | */ |
||
| 109 | public static function geoip2_country_record() {} |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @deprecated |
||
| 113 | */ |
||
| 114 | public static function geoip2_city_record() {} |
||
| 115 | |||
| 116 | /** |
||
| 117 | * @deprecated |
||
| 118 | */ |
||
| 119 | public static function geoip2_country_code() {} |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @deprecated |
||
| 123 | */ |
||
| 124 | public static function get_country_by_ip() {} |
||
| 125 | |||
| 126 | /** |
||
| 127 | * @deprecated |
||
| 128 | */ |
||
| 129 | public static function sanitize_vat_settings() {} |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @deprecated |
||
| 133 | */ |
||
| 134 | public static function sanitize_vat_rates() {} |
||
| 135 | |||
| 136 | /** |
||
| 137 | * @deprecated |
||
| 138 | */ |
||
| 139 | public static function add_class() {} |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @deprecated |
||
| 143 | */ |
||
| 144 | public static function delete_class() {} |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @deprecated |
||
| 148 | */ |
||
| 149 | public static function update_eu_rates() {} |
||
| 150 | |||
| 151 | /** |
||
| 152 | * @deprecated |
||
| 153 | */ |
||
| 154 | public static function hide_vat_fields() {} |
||
| 155 | |||
| 156 | /** |
||
| 157 | * @deprecated |
||
| 158 | */ |
||
| 159 | public static function same_country_rule() {} |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @deprecated |
||
| 163 | */ |
||
| 164 | public static function sanitize_vat() {} |
||
| 165 | |||
| 166 | /** |
||
| 167 | * @deprecated |
||
| 168 | */ |
||
| 169 | public static function vies_check() {} |
||
| 170 | |||
| 171 | /** |
||
| 172 | * @deprecated |
||
| 173 | */ |
||
| 174 | public static function check_vat() {} |
||
| 175 | |||
| 176 | /** |
||
| 177 | * @deprecated |
||
| 178 | */ |
||
| 179 | public static function requires_vat() {} |
||
| 180 | |||
| 181 | /** |
||
| 182 | * @deprecated |
||
| 183 | */ |
||
| 184 | public static function tax_label() {} |
||
| 185 | |||
| 186 | /** |
||
| 187 | * @deprecated |
||
| 188 | */ |
||
| 189 | public static function get_rate_classes() {} |
||
| 190 | |||
| 191 | /** |
||
| 192 | * @deprecated |
||
| 193 | */ |
||
| 194 | public static function get_all_classes() {} |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @deprecated |
||
| 198 | */ |
||
| 199 | public static function get_class_desc() {} |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @deprecated |
||
| 203 | */ |
||
| 204 | public static function get_vat_groups() {} |
||
| 205 | |||
| 206 | /** |
||
| 207 | * @deprecated |
||
| 208 | */ |
||
| 209 | public static function get_rules() {} |
||
| 210 | |||
| 211 | /** |
||
| 212 | * @deprecated |
||
| 213 | */ |
||
| 214 | public static function get_vat_rates() {} |
||
| 215 | |||
| 216 | /** |
||
| 217 | * @deprecated |
||
| 218 | */ |
||
| 219 | public static function get_non_standard_rates() {} |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @deprecated |
||
| 223 | */ |
||
| 224 | public static function item_class_label() {} |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @deprecated |
||
| 228 | */ |
||
| 229 | public static function get_item_rule() {} |
||
| 230 | |||
| 231 | /** |
||
| 232 | * @deprecated |
||
| 233 | */ |
||
| 234 | public static function item_rule_label() {} |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @deprecated |
||
| 238 | */ |
||
| 239 | public static function item_has_digital_rule() {} |
||
| 240 | |||
| 241 | /** |
||
| 242 | * @deprecated |
||
| 243 | */ |
||
| 244 | public static function invoice_has_digital_rule() {} |
||
| 245 | |||
| 246 | /** |
||
| 247 | * @deprecated |
||
| 248 | */ |
||
| 249 | public static function item_is_taxable() {} |
||
| 250 | |||
| 251 | /** |
||
| 252 | * @deprecated |
||
| 253 | */ |
||
| 254 | public static function find_rate() {} |
||
| 255 | |||
| 256 | /** |
||
| 257 | * @deprecated |
||
| 258 | */ |
||
| 259 | public static function get_rate() {} |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @deprecated |
||
| 263 | */ |
||
| 264 | public static function current_vat_data() {} |
||
| 265 | |||
| 266 | /** |
||
| 267 | * @deprecated |
||
| 268 | */ |
||
| 269 | public static function get_user_country() {} |
||
| 270 | |||
| 271 | /** |
||
| 272 | * @deprecated |
||
| 273 | */ |
||
| 274 | public static function set_user_country() {} |
||
| 275 | |||
| 276 | /** |
||
| 277 | * @deprecated |
||
| 278 | */ |
||
| 279 | public static function get_user_vat_number() {} |
||
| 280 | |||
| 281 | /** |
||
| 282 | * @deprecated |
||
| 283 | */ |
||
| 284 | public static function get_user_company() {} |
||
| 285 | |||
| 286 | /** |
||
| 287 | * @deprecated |
||
| 288 | */ |
||
| 289 | public static function save_user_vat_details() {} |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @deprecated |
||
| 293 | */ |
||
| 294 | public static function ajax_vat_validate() {} |
||
| 295 | |||
| 296 | /** |
||
| 297 | * @deprecated |
||
| 298 | */ |
||
| 299 | public static function validate_vat_number() {} |
||
| 300 | |||
| 301 | } |
||
| 302 | |||
| 303 |