Complex classes like TEntityTypeType 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 TEntityTypeType, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 15 | class TEntityTypeType extends IsOK |
||
| 16 | { |
||
| 17 | use TDerivableTypeAttributesTrait, AccessTypeTraits; |
||
| 18 | /** |
||
| 19 | * @property boolean $openType |
||
| 20 | */ |
||
| 21 | private $openType = false; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @property string $typeAccess |
||
| 25 | */ |
||
| 26 | private $typeAccess = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
||
| 30 | */ |
||
| 31 | private $documentation = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType[] $key |
||
| 35 | */ |
||
| 36 | private $key = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType[] $property |
||
| 40 | */ |
||
| 41 | private $property = []; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType[] $navigationProperty |
||
| 45 | */ |
||
| 46 | private $navigationProperty = []; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
||
| 50 | */ |
||
| 51 | private $valueAnnotation = []; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
||
| 55 | */ |
||
| 56 | private $typeAnnotation = []; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Gets as openType |
||
| 60 | * |
||
| 61 | * @return boolean |
||
| 62 | */ |
||
| 63 | public function getOpenType() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Sets a new openType |
||
| 70 | * |
||
| 71 | * @param boolean $openType |
||
| 72 | * @return self |
||
| 73 | */ |
||
| 74 | public function setOpenType($openType) |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Gets as typeAccess |
||
| 82 | * |
||
| 83 | * @return string |
||
| 84 | */ |
||
| 85 | public function getTypeAccess() |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Sets a new typeAccess |
||
| 92 | * |
||
| 93 | * @param string $typeAccess |
||
| 94 | * @return self |
||
| 95 | */ |
||
| 96 | public function setTypeAccess($typeAccess) |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Gets as documentation |
||
| 104 | * |
||
| 105 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType |
||
| 106 | */ |
||
| 107 | public function getDocumentation() |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Sets a new documentation |
||
| 114 | * |
||
| 115 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
||
| 116 | * @return self |
||
| 117 | */ |
||
| 118 | public function setDocumentation(TDocumentationType $documentation) |
||
| 123 | |||
| 124 | /** |
||
| 125 | * Adds as propertyRef |
||
| 126 | * |
||
| 127 | * @return self |
||
| 128 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType $propertyRef |
||
| 129 | */ |
||
| 130 | public function addToKey(TPropertyRefType $propertyRef) |
||
| 135 | |||
| 136 | /** |
||
| 137 | * isset key |
||
| 138 | * |
||
| 139 | * @param scalar $index |
||
| 140 | * @return boolean |
||
| 141 | */ |
||
| 142 | public function issetKey($index) |
||
| 146 | |||
| 147 | /** |
||
| 148 | * unset key |
||
| 149 | * |
||
| 150 | * @param scalar $index |
||
| 151 | * @return void |
||
| 152 | */ |
||
| 153 | public function unsetKey($index) |
||
| 157 | |||
| 158 | /** |
||
| 159 | * Gets as key |
||
| 160 | * |
||
| 161 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType[] |
||
| 162 | */ |
||
| 163 | public function getKey() |
||
| 167 | |||
| 168 | /** |
||
| 169 | * Sets a new key |
||
| 170 | * |
||
| 171 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType[] $key |
||
| 172 | * @return self |
||
| 173 | */ |
||
| 174 | public function setKey(array $key) |
||
| 179 | |||
| 180 | /** |
||
| 181 | * Adds as property |
||
| 182 | * |
||
| 183 | * @return self |
||
| 184 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType $property |
||
| 185 | */ |
||
| 186 | public function addToProperty(TEntityPropertyType $property) |
||
| 191 | |||
| 192 | /** |
||
| 193 | * isset property |
||
| 194 | * |
||
| 195 | * @param scalar $index |
||
| 196 | * @return boolean |
||
| 197 | */ |
||
| 198 | public function issetProperty($index) |
||
| 202 | |||
| 203 | /** |
||
| 204 | * unset property |
||
| 205 | * |
||
| 206 | * @param scalar $index |
||
| 207 | * @return void |
||
| 208 | */ |
||
| 209 | public function unsetProperty($index) |
||
| 213 | |||
| 214 | /** |
||
| 215 | * Gets as property |
||
| 216 | * |
||
| 217 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType[] |
||
| 218 | */ |
||
| 219 | public function getProperty() |
||
| 223 | |||
| 224 | /** |
||
| 225 | * Sets a new property |
||
| 226 | * |
||
| 227 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType[] $property |
||
| 228 | * @return self |
||
| 229 | */ |
||
| 230 | public function setProperty(array $property) |
||
| 235 | |||
| 236 | /** |
||
| 237 | * Adds as navigationProperty |
||
| 238 | * |
||
| 239 | * @return self |
||
| 240 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType $navigationProperty |
||
| 241 | */ |
||
| 242 | public function addToNavigationProperty(TNavigationPropertyType $navigationProperty) |
||
| 247 | |||
| 248 | /** |
||
| 249 | * isset navigationProperty |
||
| 250 | * |
||
| 251 | * @param scalar $index |
||
| 252 | * @return boolean |
||
| 253 | */ |
||
| 254 | public function issetNavigationProperty($index) |
||
| 258 | |||
| 259 | /** |
||
| 260 | * unset navigationProperty |
||
| 261 | * |
||
| 262 | * @param scalar $index |
||
| 263 | * @return void |
||
| 264 | */ |
||
| 265 | public function unsetNavigationProperty($index) |
||
| 269 | |||
| 270 | /** |
||
| 271 | * Gets as navigationProperty |
||
| 272 | * |
||
| 273 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType[] |
||
| 274 | */ |
||
| 275 | public function getNavigationProperty() |
||
| 279 | |||
| 280 | /** |
||
| 281 | * Sets a new navigationProperty |
||
| 282 | * |
||
| 283 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType[] $navigationProperty |
||
| 284 | * @return self |
||
| 285 | */ |
||
| 286 | public function setNavigationProperty(array $navigationProperty) |
||
| 291 | |||
| 292 | /** |
||
| 293 | * Adds as valueAnnotation |
||
| 294 | * |
||
| 295 | * @return self |
||
| 296 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation |
||
| 297 | */ |
||
| 298 | public function addToValueAnnotation(TValueAnnotationType $valueAnnotation) |
||
| 303 | |||
| 304 | /** |
||
| 305 | * isset valueAnnotation |
||
| 306 | * |
||
| 307 | * @param scalar $index |
||
| 308 | * @return boolean |
||
| 309 | */ |
||
| 310 | public function issetValueAnnotation($index) |
||
| 314 | |||
| 315 | /** |
||
| 316 | * unset valueAnnotation |
||
| 317 | * |
||
| 318 | * @param scalar $index |
||
| 319 | * @return void |
||
| 320 | */ |
||
| 321 | public function unsetValueAnnotation($index) |
||
| 325 | |||
| 326 | /** |
||
| 327 | * Gets as valueAnnotation |
||
| 328 | * |
||
| 329 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] |
||
| 330 | */ |
||
| 331 | public function getValueAnnotation() |
||
| 335 | |||
| 336 | /** |
||
| 337 | * Sets a new valueAnnotation |
||
| 338 | * |
||
| 339 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
||
| 340 | * @return self |
||
| 341 | */ |
||
| 342 | public function setValueAnnotation(array $valueAnnotation) |
||
| 347 | |||
| 348 | /** |
||
| 349 | * Adds as typeAnnotation |
||
| 350 | * |
||
| 351 | * @return self |
||
| 352 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation |
||
| 353 | */ |
||
| 354 | public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation) |
||
| 359 | |||
| 360 | /** |
||
| 361 | * isset typeAnnotation |
||
| 362 | * |
||
| 363 | * @param scalar $index |
||
| 364 | * @return boolean |
||
| 365 | */ |
||
| 366 | public function issetTypeAnnotation($index) |
||
| 370 | |||
| 371 | /** |
||
| 372 | * unset typeAnnotation |
||
| 373 | * |
||
| 374 | * @param scalar $index |
||
| 375 | * @return void |
||
| 376 | */ |
||
| 377 | public function unsetTypeAnnotation($index) |
||
| 381 | |||
| 382 | /** |
||
| 383 | * Gets as typeAnnotation |
||
| 384 | * |
||
| 385 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] |
||
| 386 | */ |
||
| 387 | public function getTypeAnnotation() |
||
| 391 | |||
| 392 | /** |
||
| 393 | * Sets a new typeAnnotation |
||
| 394 | * |
||
| 395 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
||
| 396 | * @return self |
||
| 397 | */ |
||
| 398 | public function setTypeAnnotation(array $typeAnnotation) |
||
| 403 | |||
| 404 | public function isOK(&$msg = null) |
||
| 454 | } |
||
| 455 |