Conditions | 21 |
Paths | 21 |
Total Lines | 30 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 |
||
39 | private static function significantToSerialization(EdmError $error) |
||
40 | { |
||
41 | if (ValidationHelper::isInterfaceCritical($error)) { |
||
42 | return true; |
||
43 | } |
||
44 | |||
45 | switch ($error->getErrorCode()) { |
||
46 | case EdmErrorCode::InvalidName(): |
||
47 | case EdmErrorCode::NameTooLong(): |
||
48 | case EdmErrorCode::InvalidNamespaceName(): |
||
49 | case EdmErrorCode::SystemNamespaceEncountered(): |
||
50 | case EdmErrorCode::RowTypeMustNotHaveBaseType(): |
||
51 | case EdmErrorCode::ReferencedTypeMustHaveValidName(): |
||
52 | case EdmErrorCode::FunctionImportEntitySetExpressionIsInvalid(): |
||
53 | case EdmErrorCode::FunctionImportParameterIncorrectType(): |
||
54 | case EdmErrorCode::OnlyInputParametersAllowedInFunctions(): |
||
55 | case EdmErrorCode::InvalidFunctionImportParameterMode(): |
||
56 | case EdmErrorCode::TypeMustNotHaveKindOfNone(): |
||
57 | case EdmErrorCode::PrimitiveTypeMustNotHaveKindOfNone(): |
||
58 | case EdmErrorCode::PropertyMustNotHaveKindOfNone(): |
||
59 | case EdmErrorCode::TermMustNotHaveKindOfNone(): |
||
60 | case EdmErrorCode::SchemaElementMustNotHaveKindOfNone(): |
||
61 | case EdmErrorCode::EntityContainerElementMustNotHaveKindOfNone(): |
||
62 | case EdmErrorCode::BinaryValueCannotHaveEmptyValue(): |
||
63 | case EdmErrorCode::EnumMustHaveIntegerUnderlyingType(): |
||
64 | case EdmErrorCode::EnumMemberTypeMustMatchEnumUnderlyingType(): |
||
65 | return true; |
||
66 | } |
||
67 | |||
68 | return false; |
||
69 | } |
||
71 |