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 |
||
9 | class InMemoryJson extends Json implements ReadableMessage, WritableMessage |
||
10 | { |
||
11 | public function getRawBody() |
||
15 | |||
16 | public function getDecodedBody() |
||
20 | |||
21 | public function getAttributes() |
||
25 | |||
26 | public function isLastRetry($retryOccurence = \Puzzle\AMQP\Consumers\Retry::DEFAULT_RETRY_OCCURENCE) |
||
32 | |||
33 | public function applyHooks(MessageHookCollection $messageHookCollection) |
||
37 | |||
38 | View Code Duplication | public function getRoutingKeyFromHeader() |
|
49 | } |
||
50 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.