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