Complex classes like TFunctionType 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 TFunctionType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class TFunctionType extends IsOK |
||
17 | { |
||
18 | use TUndottedIdentifierTrait, TSimpleIdentifierTrait, TParameterTypeSemanticsTrait; |
||
19 | /** |
||
20 | * @property string $name |
||
21 | */ |
||
22 | private $name = null; |
||
23 | |||
24 | /** |
||
25 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType[] $returnType |
||
26 | */ |
||
27 | private $returnType = []; |
||
28 | |||
29 | /** |
||
30 | * @property boolean $aggregate |
||
31 | */ |
||
32 | private $aggregate = null; |
||
33 | |||
34 | /** |
||
35 | * @property boolean $builtIn |
||
36 | */ |
||
37 | private $builtIn = null; |
||
38 | |||
39 | /** |
||
40 | * @property string $storeFunctionName |
||
41 | */ |
||
42 | private $storeFunctionName = null; |
||
43 | |||
44 | /** |
||
45 | * @property boolean $niladicFunction |
||
46 | */ |
||
47 | private $niladicFunction = null; |
||
48 | |||
49 | /** |
||
50 | * @property boolean $isComposable |
||
51 | */ |
||
52 | private $isComposable = null; |
||
53 | |||
54 | /** |
||
55 | * @property string $parameterTypeSemantics |
||
56 | */ |
||
57 | private $parameterTypeSemantics = "AllowImplicitConversion"; |
||
58 | |||
59 | /** |
||
60 | * @property string $schema |
||
61 | */ |
||
62 | private $schema = null; |
||
63 | |||
64 | /** |
||
65 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
||
66 | */ |
||
67 | private $documentation = null; |
||
68 | |||
69 | /** |
||
70 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType[] $parameter |
||
71 | */ |
||
72 | private $parameter = []; |
||
73 | |||
74 | /** |
||
75 | * @property string[] $commandText |
||
76 | */ |
||
77 | private $commandText = []; |
||
78 | |||
79 | /** |
||
80 | * Gets as name |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getName() |
||
88 | |||
89 | /** |
||
90 | * Sets a new name |
||
91 | * |
||
92 | * @param string $name |
||
93 | * @return self |
||
94 | */ |
||
95 | public function setName($name) |
||
100 | |||
101 | /** |
||
102 | * Adds as returnType |
||
103 | * |
||
104 | * @return self |
||
105 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType $returnType |
||
106 | */ |
||
107 | public function addToReturnType(TFunctionReturnTypeType $returnType) |
||
112 | |||
113 | /** |
||
114 | * isset returnType |
||
115 | * |
||
116 | * @param scalar $index |
||
117 | * @return boolean |
||
118 | */ |
||
119 | public function issetReturnType($index) |
||
123 | |||
124 | /** |
||
125 | * unset returnType |
||
126 | * |
||
127 | * @param scalar $index |
||
128 | * @return void |
||
129 | */ |
||
130 | public function unsetReturnType($index) |
||
134 | |||
135 | /** |
||
136 | * Gets as returnType |
||
137 | * |
||
138 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType[] |
||
139 | */ |
||
140 | public function getReturnType() |
||
144 | |||
145 | /** |
||
146 | * Sets a new returnType |
||
147 | * |
||
148 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType[] $returnType |
||
149 | * @return self |
||
150 | */ |
||
151 | public function setReturnType(array $returnType) |
||
156 | |||
157 | /** |
||
158 | * Gets as aggregate |
||
159 | * |
||
160 | * @return boolean |
||
161 | */ |
||
162 | public function getAggregate() |
||
166 | |||
167 | /** |
||
168 | * Sets a new aggregate |
||
169 | * |
||
170 | * @param boolean $aggregate |
||
171 | * @return self |
||
172 | */ |
||
173 | public function setAggregate($aggregate) |
||
178 | |||
179 | /** |
||
180 | * Gets as builtIn |
||
181 | * |
||
182 | * @return boolean |
||
183 | */ |
||
184 | public function getBuiltIn() |
||
188 | |||
189 | /** |
||
190 | * Sets a new builtIn |
||
191 | * |
||
192 | * @param boolean $builtIn |
||
193 | * @return self |
||
194 | */ |
||
195 | public function setBuiltIn($builtIn) |
||
200 | |||
201 | /** |
||
202 | * Gets as storeFunctionName |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | public function getStoreFunctionName() |
||
210 | |||
211 | /** |
||
212 | * Sets a new storeFunctionName |
||
213 | * |
||
214 | * @param string $storeFunctionName |
||
215 | * @return self |
||
216 | */ |
||
217 | public function setStoreFunctionName($storeFunctionName) |
||
222 | |||
223 | /** |
||
224 | * Gets as niladicFunction |
||
225 | * |
||
226 | * @return boolean |
||
227 | */ |
||
228 | public function getNiladicFunction() |
||
232 | |||
233 | /** |
||
234 | * Sets a new niladicFunction |
||
235 | * |
||
236 | * @param boolean $niladicFunction |
||
237 | * @return self |
||
238 | */ |
||
239 | public function setNiladicFunction($niladicFunction) |
||
244 | |||
245 | /** |
||
246 | * Gets as isComposable |
||
247 | * |
||
248 | * @return boolean |
||
249 | */ |
||
250 | public function getIsComposable() |
||
254 | |||
255 | /** |
||
256 | * Sets a new isComposable |
||
257 | * |
||
258 | * @param boolean $isComposable |
||
259 | * @return self |
||
260 | */ |
||
261 | public function setIsComposable($isComposable) |
||
266 | |||
267 | /** |
||
268 | * Gets as parameterTypeSemantics |
||
269 | * |
||
270 | * @return string |
||
271 | */ |
||
272 | public function getParameterTypeSemantics() |
||
276 | |||
277 | /** |
||
278 | * Sets a new parameterTypeSemantics |
||
279 | * |
||
280 | * @param string $parameterTypeSemantics |
||
281 | * @return self |
||
282 | */ |
||
283 | public function setParameterTypeSemantics($parameterTypeSemantics) |
||
288 | |||
289 | /** |
||
290 | * Gets as schema |
||
291 | * |
||
292 | * @return string |
||
293 | */ |
||
294 | public function getSchema() |
||
298 | |||
299 | /** |
||
300 | * Sets a new schema |
||
301 | * |
||
302 | * @param string $schema |
||
303 | * @return self |
||
304 | */ |
||
305 | public function setSchema($schema) |
||
310 | |||
311 | /** |
||
312 | * Gets as documentation |
||
313 | * |
||
314 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType |
||
315 | */ |
||
316 | public function getDocumentation() |
||
320 | |||
321 | /** |
||
322 | * Sets a new documentation |
||
323 | * |
||
324 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
||
325 | * @return self |
||
326 | */ |
||
327 | public function setDocumentation(TDocumentationType $documentation) |
||
332 | |||
333 | /** |
||
334 | * Adds as parameter |
||
335 | * |
||
336 | * @return self |
||
337 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType $parameter |
||
338 | */ |
||
339 | public function addToParameter(TParameterType $parameter) |
||
344 | |||
345 | /** |
||
346 | * isset parameter |
||
347 | * |
||
348 | * @param scalar $index |
||
349 | * @return boolean |
||
350 | */ |
||
351 | public function issetParameter($index) |
||
355 | |||
356 | /** |
||
357 | * unset parameter |
||
358 | * |
||
359 | * @param scalar $index |
||
360 | * @return void |
||
361 | */ |
||
362 | public function unsetParameter($index) |
||
366 | |||
367 | /** |
||
368 | * Gets as parameter |
||
369 | * |
||
370 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType[] |
||
371 | */ |
||
372 | public function getParameter() |
||
376 | |||
377 | /** |
||
378 | * Sets a new parameter |
||
379 | * |
||
380 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType[] $parameter |
||
381 | * @return self |
||
382 | */ |
||
383 | public function setParameter(array $parameter) |
||
388 | |||
389 | /** |
||
390 | * Adds as commandText |
||
391 | * |
||
392 | * @return self |
||
393 | * @param string $commandText |
||
394 | */ |
||
395 | public function addToCommandText($commandText) |
||
400 | |||
401 | /** |
||
402 | * isset commandText |
||
403 | * |
||
404 | * @param scalar $index |
||
405 | * @return boolean |
||
406 | */ |
||
407 | public function issetCommandText($index) |
||
411 | |||
412 | /** |
||
413 | * unset commandText |
||
414 | * |
||
415 | * @param scalar $index |
||
416 | * @return void |
||
417 | */ |
||
418 | public function unsetCommandText($index) |
||
422 | |||
423 | /** |
||
424 | * Gets as commandText |
||
425 | * |
||
426 | * @return string[] |
||
427 | */ |
||
428 | public function getCommandText() |
||
432 | |||
433 | /** |
||
434 | * Sets a new commandText |
||
435 | * |
||
436 | * @param string $commandText |
||
437 | * @return self |
||
438 | */ |
||
439 | public function setCommandText(array $commandText) |
||
444 | |||
445 | public function isOK(&$msg = null) |
||
500 | } |
||
501 |