Complex classes like TComplexTypePropertyType 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 TComplexTypePropertyType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
11 | class TComplexTypePropertyType |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @property string $name |
||
16 | */ |
||
17 | private $name = null; |
||
18 | |||
19 | /** |
||
20 | * @property string $type |
||
21 | */ |
||
22 | private $type = null; |
||
23 | |||
24 | /** |
||
25 | * @property boolean $nullable |
||
26 | */ |
||
27 | private $nullable = null; |
||
28 | |||
29 | /** |
||
30 | * @property string $defaultValue |
||
31 | */ |
||
32 | private $defaultValue = null; |
||
33 | |||
34 | /** |
||
35 | * @property string $maxLength |
||
36 | */ |
||
37 | private $maxLength = null; |
||
38 | |||
39 | /** |
||
40 | * @property boolean $fixedLength |
||
41 | */ |
||
42 | private $fixedLength = null; |
||
43 | |||
44 | /** |
||
45 | * @property integer $precision |
||
46 | */ |
||
47 | private $precision = null; |
||
48 | |||
49 | /** |
||
50 | * @property integer $scale |
||
51 | */ |
||
52 | private $scale = null; |
||
53 | |||
54 | /** |
||
55 | * @property boolean $unicode |
||
56 | */ |
||
57 | private $unicode = null; |
||
58 | |||
59 | /** |
||
60 | * @property string $collation |
||
61 | */ |
||
62 | private $collation = null; |
||
63 | |||
64 | /** |
||
65 | * @property string $sRID |
||
66 | */ |
||
67 | private $sRID = null; |
||
68 | |||
69 | /** |
||
70 | * @property string $concurrencyMode |
||
71 | */ |
||
72 | private $concurrencyMode = null; |
||
73 | |||
74 | /** |
||
75 | * @property string $setterAccess |
||
76 | */ |
||
77 | private $setterAccess = null; |
||
78 | |||
79 | /** |
||
80 | * @property string $getterAccess |
||
81 | */ |
||
82 | private $getterAccess = null; |
||
83 | |||
84 | /** |
||
85 | * @property \MetadataV3\edm\TDocumentationType[] $documentation |
||
86 | */ |
||
87 | private $documentation = array( |
||
88 | |||
89 | ); |
||
90 | |||
91 | /** |
||
92 | * @property \MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
||
93 | */ |
||
94 | private $valueAnnotation = array( |
||
95 | |||
96 | ); |
||
97 | |||
98 | /** |
||
99 | * @property \MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
||
100 | */ |
||
101 | private $typeAnnotation = array( |
||
102 | |||
103 | ); |
||
104 | |||
105 | /** |
||
106 | * Gets as name |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | public function getName() |
||
114 | |||
115 | /** |
||
116 | * Sets a new name |
||
117 | * |
||
118 | * @param string $name |
||
119 | * @return self |
||
120 | */ |
||
121 | public function setName($name) |
||
126 | |||
127 | /** |
||
128 | * Gets as type |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getType() |
||
136 | |||
137 | /** |
||
138 | * Sets a new type |
||
139 | * |
||
140 | * @param string $type |
||
141 | * @return self |
||
142 | */ |
||
143 | public function setType($type) |
||
148 | |||
149 | /** |
||
150 | * Gets as nullable |
||
151 | * |
||
152 | * @return boolean |
||
153 | */ |
||
154 | public function getNullable() |
||
158 | |||
159 | /** |
||
160 | * Sets a new nullable |
||
161 | * |
||
162 | * @param boolean $nullable |
||
163 | * @return self |
||
164 | */ |
||
165 | public function setNullable($nullable) |
||
170 | |||
171 | /** |
||
172 | * Gets as defaultValue |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | public function getDefaultValue() |
||
180 | |||
181 | /** |
||
182 | * Sets a new defaultValue |
||
183 | * |
||
184 | * @param string $defaultValue |
||
185 | * @return self |
||
186 | */ |
||
187 | public function setDefaultValue($defaultValue) |
||
192 | |||
193 | /** |
||
194 | * Gets as maxLength |
||
195 | * |
||
196 | * @return string |
||
197 | */ |
||
198 | public function getMaxLength() |
||
202 | |||
203 | /** |
||
204 | * Sets a new maxLength |
||
205 | * |
||
206 | * @param string $maxLength |
||
207 | * @return self |
||
208 | */ |
||
209 | public function setMaxLength($maxLength) |
||
214 | |||
215 | /** |
||
216 | * Gets as fixedLength |
||
217 | * |
||
218 | * @return boolean |
||
219 | */ |
||
220 | public function getFixedLength() |
||
224 | |||
225 | /** |
||
226 | * Sets a new fixedLength |
||
227 | * |
||
228 | * @param boolean $fixedLength |
||
229 | * @return self |
||
230 | */ |
||
231 | public function setFixedLength($fixedLength) |
||
236 | |||
237 | /** |
||
238 | * Gets as precision |
||
239 | * |
||
240 | * @return integer |
||
241 | */ |
||
242 | public function getPrecision() |
||
246 | |||
247 | /** |
||
248 | * Sets a new precision |
||
249 | * |
||
250 | * @param integer $precision |
||
251 | * @return self |
||
252 | */ |
||
253 | public function setPrecision($precision) |
||
258 | |||
259 | /** |
||
260 | * Gets as scale |
||
261 | * |
||
262 | * @return integer |
||
263 | */ |
||
264 | public function getScale() |
||
268 | |||
269 | /** |
||
270 | * Sets a new scale |
||
271 | * |
||
272 | * @param integer $scale |
||
273 | * @return self |
||
274 | */ |
||
275 | public function setScale($scale) |
||
280 | |||
281 | /** |
||
282 | * Gets as unicode |
||
283 | * |
||
284 | * @return boolean |
||
285 | */ |
||
286 | public function getUnicode() |
||
290 | |||
291 | /** |
||
292 | * Sets a new unicode |
||
293 | * |
||
294 | * @param boolean $unicode |
||
295 | * @return self |
||
296 | */ |
||
297 | public function setUnicode($unicode) |
||
302 | |||
303 | /** |
||
304 | * Gets as collation |
||
305 | * |
||
306 | * @return string |
||
307 | */ |
||
308 | public function getCollation() |
||
312 | |||
313 | /** |
||
314 | * Sets a new collation |
||
315 | * |
||
316 | * @param string $collation |
||
317 | * @return self |
||
318 | */ |
||
319 | public function setCollation($collation) |
||
324 | |||
325 | /** |
||
326 | * Gets as sRID |
||
327 | * |
||
328 | * @return string |
||
329 | */ |
||
330 | public function getSRID() |
||
334 | |||
335 | /** |
||
336 | * Sets a new sRID |
||
337 | * |
||
338 | * @param string $sRID |
||
339 | * @return self |
||
340 | */ |
||
341 | public function setSRID($sRID) |
||
346 | |||
347 | /** |
||
348 | * Gets as concurrencyMode |
||
349 | * |
||
350 | * @return string |
||
351 | */ |
||
352 | public function getConcurrencyMode() |
||
356 | |||
357 | /** |
||
358 | * Sets a new concurrencyMode |
||
359 | * |
||
360 | * @param string $concurrencyMode |
||
361 | * @return self |
||
362 | */ |
||
363 | public function setConcurrencyMode($concurrencyMode) |
||
368 | |||
369 | /** |
||
370 | * Gets as setterAccess |
||
371 | * |
||
372 | * @return string |
||
373 | */ |
||
374 | public function getSetterAccess() |
||
378 | |||
379 | /** |
||
380 | * Sets a new setterAccess |
||
381 | * |
||
382 | * @param string $setterAccess |
||
383 | * @return self |
||
384 | */ |
||
385 | public function setSetterAccess($setterAccess) |
||
390 | |||
391 | /** |
||
392 | * Gets as getterAccess |
||
393 | * |
||
394 | * @return string |
||
395 | */ |
||
396 | public function getGetterAccess() |
||
400 | |||
401 | /** |
||
402 | * Sets a new getterAccess |
||
403 | * |
||
404 | * @param string $getterAccess |
||
405 | * @return self |
||
406 | */ |
||
407 | public function setGetterAccess($getterAccess) |
||
412 | |||
413 | /** |
||
414 | * Adds as documentation |
||
415 | * |
||
416 | * @return self |
||
417 | * @param \MetadataV3\edm\TDocumentationType $documentation |
||
418 | */ |
||
419 | public function addToDocumentation(\MetadataV3\edm\TDocumentationType $documentation) |
||
424 | |||
425 | /** |
||
426 | * isset documentation |
||
427 | * |
||
428 | * @param scalar $index |
||
429 | * @return boolean |
||
430 | */ |
||
431 | public function issetDocumentation($index) |
||
435 | |||
436 | /** |
||
437 | * unset documentation |
||
438 | * |
||
439 | * @param scalar $index |
||
440 | * @return void |
||
441 | */ |
||
442 | public function unsetDocumentation($index) |
||
446 | |||
447 | /** |
||
448 | * Gets as documentation |
||
449 | * |
||
450 | * @return \MetadataV3\edm\TDocumentationType[] |
||
451 | */ |
||
452 | public function getDocumentation() |
||
456 | |||
457 | /** |
||
458 | * Sets a new documentation |
||
459 | * |
||
460 | * @param \MetadataV3\edm\TDocumentationType[] $documentation |
||
461 | * @return self |
||
462 | */ |
||
463 | public function setDocumentation(array $documentation) |
||
468 | |||
469 | /** |
||
470 | * Adds as valueAnnotation |
||
471 | * |
||
472 | * @return self |
||
473 | * @param \MetadataV3\edm\TValueAnnotationType $valueAnnotation |
||
474 | */ |
||
475 | public function addToValueAnnotation(\MetadataV3\edm\TValueAnnotationType $valueAnnotation) |
||
480 | |||
481 | /** |
||
482 | * isset valueAnnotation |
||
483 | * |
||
484 | * @param scalar $index |
||
485 | * @return boolean |
||
486 | */ |
||
487 | public function issetValueAnnotation($index) |
||
491 | |||
492 | /** |
||
493 | * unset valueAnnotation |
||
494 | * |
||
495 | * @param scalar $index |
||
496 | * @return void |
||
497 | */ |
||
498 | public function unsetValueAnnotation($index) |
||
502 | |||
503 | /** |
||
504 | * Gets as valueAnnotation |
||
505 | * |
||
506 | * @return \MetadataV3\edm\TValueAnnotationType[] |
||
507 | */ |
||
508 | public function getValueAnnotation() |
||
512 | |||
513 | /** |
||
514 | * Sets a new valueAnnotation |
||
515 | * |
||
516 | * @param \MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
||
517 | * @return self |
||
518 | */ |
||
519 | public function setValueAnnotation(array $valueAnnotation) |
||
524 | |||
525 | /** |
||
526 | * Adds as typeAnnotation |
||
527 | * |
||
528 | * @return self |
||
529 | * @param \MetadataV3\edm\TTypeAnnotationType $typeAnnotation |
||
530 | */ |
||
531 | public function addToTypeAnnotation(\MetadataV3\edm\TTypeAnnotationType $typeAnnotation) |
||
536 | |||
537 | /** |
||
538 | * isset typeAnnotation |
||
539 | * |
||
540 | * @param scalar $index |
||
541 | * @return boolean |
||
542 | */ |
||
543 | public function issetTypeAnnotation($index) |
||
547 | |||
548 | /** |
||
549 | * unset typeAnnotation |
||
550 | * |
||
551 | * @param scalar $index |
||
552 | * @return void |
||
553 | */ |
||
554 | public function unsetTypeAnnotation($index) |
||
558 | |||
559 | /** |
||
560 | * Gets as typeAnnotation |
||
561 | * |
||
562 | * @return \MetadataV3\edm\TTypeAnnotationType[] |
||
563 | */ |
||
564 | public function getTypeAnnotation() |
||
568 | |||
569 | /** |
||
570 | * Sets a new typeAnnotation |
||
571 | * |
||
572 | * @param \MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
||
573 | * @return self |
||
574 | */ |
||
575 | public function setTypeAnnotation(array $typeAnnotation) |
||
580 | } |
||
581 |