Complex classes like validator 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 validator, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
39 | class validator { |
||
40 | |||
41 | /** |
||
42 | * Validate if general section will be shown. |
||
43 | * |
||
44 | * @return boolean |
||
45 | */ |
||
46 | public static function section_general_shown() { |
||
51 | |||
52 | /** |
||
53 | * Validate if record meeting section will be shown. |
||
54 | * |
||
55 | * @return boolean |
||
56 | */ |
||
57 | public static function section_record_meeting_shown() { |
||
67 | |||
68 | /** |
||
69 | * Validate if import recording section will be shown. |
||
70 | * |
||
71 | * @return boolean |
||
72 | */ |
||
73 | public static function section_import_recordings_shown() { |
||
78 | |||
79 | /** |
||
80 | * Validate if show recording section will be shown. |
||
81 | * |
||
82 | * @return boolean |
||
83 | */ |
||
84 | public static function section_show_recordings_shown() { |
||
97 | |||
98 | /** |
||
99 | * Validate if wait moderator section will be shown. |
||
100 | * |
||
101 | * @return boolean |
||
102 | */ |
||
103 | public static function section_wait_moderator_shown() { |
||
110 | |||
111 | /** |
||
112 | * Validate if static voice bridge section will be shown. |
||
113 | * |
||
114 | * @return boolean |
||
115 | */ |
||
116 | public static function section_static_voice_bridge_shown() { |
||
120 | |||
121 | /** |
||
122 | * Validate if preupload presentation section will be shown. |
||
123 | * |
||
124 | * @return boolean |
||
125 | */ |
||
126 | public static function section_preupload_presentation_shown() { |
||
130 | |||
131 | /** |
||
132 | * Validate if user limit section will be shown. |
||
133 | * |
||
134 | * @return boolean |
||
135 | */ |
||
136 | public static function section_user_limit_shown() { |
||
141 | |||
142 | /** |
||
143 | * Validate if scheduled duration section will be shown. |
||
144 | * |
||
145 | * @return boolean |
||
146 | */ |
||
147 | public static function section_scheduled_duration_shown() { |
||
151 | |||
152 | /** |
||
153 | * Validate if moderator default section will be shown. |
||
154 | * |
||
155 | * @return boolean |
||
156 | */ |
||
157 | public static function section_moderator_default_shown() { |
||
161 | |||
162 | /** |
||
163 | * Validate if send notification section will be shown. |
||
164 | * |
||
165 | * @return boolean |
||
166 | */ |
||
167 | public static function section_send_notifications_shown() { |
||
171 | |||
172 | /** |
||
173 | * Validate if clienttype section will be shown. |
||
174 | * |
||
175 | * @return boolean |
||
176 | */ |
||
177 | public static function section_clienttype_shown() { |
||
189 | |||
190 | /** |
||
191 | * Validate if settings extended section will be shown. |
||
192 | * |
||
193 | * @return boolean |
||
194 | */ |
||
195 | public static function section_settings_extended_shown() { |
||
200 | |||
201 | /** |
||
202 | * Validate if muteonstart section will be shown. |
||
203 | * |
||
204 | * @return boolean |
||
205 | */ |
||
206 | public static function section_muteonstart_shown() { |
||
211 | |||
212 | /** |
||
213 | * Validate if disablecam section will be shown. |
||
214 | * |
||
215 | * @return boolean |
||
216 | */ |
||
217 | public static function section_disablecam_shown() { |
||
222 | |||
223 | /** |
||
224 | * Validate if disablemic section will be shown. |
||
225 | * |
||
226 | * @return boolean |
||
227 | */ |
||
228 | public static function section_disablemic_shown() { |
||
233 | |||
234 | /** |
||
235 | * Validate if disableprivatechat section will be shown. |
||
236 | * |
||
237 | * @return boolean |
||
238 | */ |
||
239 | public static function section_disableprivatechat_shown() { |
||
244 | |||
245 | /** |
||
246 | * Validate if disablepublicchat section will be shown. |
||
247 | * |
||
248 | * @return boolean |
||
249 | */ |
||
250 | public static function section_disablepublicchat_shown() { |
||
255 | |||
256 | /** |
||
257 | * Validate if disablenote section will be shown. |
||
258 | * |
||
259 | * @return boolean |
||
260 | */ |
||
261 | public static function section_disablenote_shown() { |
||
266 | |||
267 | /** |
||
268 | * Validate if hideuserlist section will be shown. |
||
269 | * |
||
270 | * @return boolean |
||
271 | */ |
||
272 | public static function section_hideuserlist_shown() { |
||
277 | |||
278 | /** |
||
279 | * Validate if lockedlayout section will be shown. |
||
280 | * |
||
281 | * @return boolean |
||
282 | */ |
||
283 | public static function section_lockedlayout_shown() { |
||
288 | |||
289 | /** |
||
290 | * Validate if lockonjoin section will be shown. |
||
291 | * |
||
292 | * @return boolean |
||
293 | */ |
||
294 | public static function section_lockonjoin_shown() { |
||
299 | |||
300 | /** |
||
301 | * Validate if lockonjoinconfigurable section will be shown. |
||
302 | * |
||
303 | * @return boolean |
||
304 | */ |
||
305 | public static function section_lockonjoinconfigurable_shown() { |
||
310 | } |
||
311 |