Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 22 | class Relationship extends AbstractFileableCmisObject implements RelationshipInterface |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * Gets the source object using the given OperationContext. |
||
| 26 | * |
||
| 27 | * @param OperationContextInterface|null $context |
||
| 28 | * @return CmisObjectInterface|null If the source object ID is invalid, <code>null</code> will be returned. |
||
| 29 | */ |
||
| 30 | View Code Duplication | public function getSource(OperationContextInterface $context = null) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Gets the target object using the given OperationContext. |
||
| 43 | * |
||
| 44 | * @param OperationContextInterface|null $context |
||
| 45 | * @return CmisObjectInterface If the target object ID is invalid, <code>null</code> will be returned. |
||
| 46 | */ |
||
| 47 | View Code Duplication | public function getTarget(OperationContextInterface $context = null) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Returns the source ID of this CMIS relationship (CMIS property cmis:sourceId). |
||
| 60 | * |
||
| 61 | * @return ObjectIdInterface|null the source ID or <code>null</code> if the property hasn't been requested, |
||
| 62 | * hasn't been provided by the repository, or the property value isn't set |
||
| 63 | */ |
||
| 64 | View Code Duplication | public function getSourceId() |
|
| 73 | |||
| 74 | /** |
||
| 75 | * Returns the target ID of this CMIS relationship (CMIS property cmis:targetId). |
||
| 76 | * |
||
| 77 | * @return ObjectIdInterface the target ID or <code>null</code> if the property hasn't been requested, |
||
| 78 | * hasn't been provided by the repository, or the property value isn't set |
||
| 79 | */ |
||
| 80 | View Code Duplication | public function getTargetId() |
|
| 89 | } |
||
| 90 |