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 Channel implements ChannelInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var AMQPChannel |
||
| 13 | */ |
||
| 14 | private $channel; |
||
| 15 | |||
| 16 | 14 | public function __construct(AMQPChannel $channel) |
|
| 20 | |||
| 21 | 2 | public function wait() |
|
| 25 | |||
| 26 | 1 | public function acknowledge(string $deliveryTag, bool $multiple = false) |
|
| 30 | |||
| 31 | 3 | public function nack(string $deliveryTag, bool $multiple = false, bool $requeue = false) |
|
| 35 | |||
| 36 | 2 | public function consume(Consumable $consumable) : ChannelInterface |
|
| 52 | |||
| 53 | 2 | public function publish(Publishable $message) : ChannelInterface |
|
| 72 | |||
| 73 | /** |
||
| 74 | * @param $prefetchSize |
||
| 75 | * @param int $prefetchCount |
||
| 76 | * @param $aGlobal |
||
| 77 | * |
||
| 78 | * @return mixed |
||
| 79 | */ |
||
| 80 | 1 | public function basicQos($prefetchSize = null, int $prefetchCount = 1, $aGlobal = null) |
|
| 86 | |||
| 87 | /** |
||
| 88 | * @param Queue $queue |
||
| 89 | * |
||
| 90 | * @return ChannelInterface |
||
| 91 | */ |
||
| 92 | 2 | View Code Duplication | public function declareQueue(Queue $queue) : ChannelInterface |
| 107 | |||
| 108 | 2 | public function bindQueue(Queue $queue) : ChannelInterface |
|
| 121 | |||
| 122 | 2 | View Code Duplication | public function declareExchange(Exchange $exchange) : ChannelInterface |
| 138 | |||
| 139 | /** |
||
| 140 | * @return array |
||
| 141 | */ |
||
| 142 | 2 | public function getCallbacks() : array |
|
| 146 | |||
| 147 | public function setCallbacks(array $callbacks = []) |
||
| 151 | } |
||
| 152 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.