Conditions | 10 |
Paths | 10 |
Total Lines | 36 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 1 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
21 | public function visitTypeReference(ITypeReference $reference): void |
||
22 | { |
||
23 | /** @var EdmModelVisitor $this */ |
||
24 | if (null === $reference->getDefinition()) { |
||
25 | throw new InvalidOperationException(StringConst::UnknownEnumVal_TypeKind('null')); |
||
26 | } |
||
27 | |||
28 | switch ($reference->getDefinition()->getTypeKind()) { |
||
29 | case TypeKind::Collection(): |
||
30 | $this->processCollectionTypeReference($reference->asCollection()); |
||
31 | break; |
||
32 | case TypeKind::Complex(): |
||
33 | $this->processComplexTypeReference($reference->asComplex()); |
||
34 | break; |
||
35 | case TypeKind::Entity(): |
||
36 | $this->processEntityTypeReference($reference->asEntity()); |
||
37 | break; |
||
38 | case TypeKind::EntityReference(): |
||
39 | $this->processEntityReferenceTypeReference($reference->asEntityReference()); |
||
40 | break; |
||
41 | case TypeKind::Enum(): |
||
42 | $this->processEnumTypeReference($reference->asEnum()); |
||
43 | break; |
||
44 | case TypeKind::Primitive(): |
||
45 | $this->visitPrimitiveTypeReference($reference->asPrimitive()); |
||
46 | break; |
||
47 | case TypeKind::Row(): |
||
48 | $this->processRowTypeReference($reference->asRow()); |
||
49 | break; |
||
50 | case TypeKind::None(): |
||
51 | $this->processTypeReference($reference); |
||
52 | break; |
||
53 | default: |
||
54 | throw new InvalidOperationException( |
||
55 | StringConst::UnknownEnumVal_TypeKind( |
||
56 | $reference->getDefinition()->getTypeKind()->getKey() |
||
57 | ) |
||
121 |