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 |
||
10 | class Channel implements ChannelInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var AMQPChannel |
||
14 | */ |
||
15 | private $channel; |
||
16 | |||
17 | 16 | public function __construct(AMQPChannel $channel) |
|
21 | |||
22 | 2 | public function wait() |
|
26 | |||
27 | 1 | public function acknowledge(string $deliveryTag, bool $multiple = false) |
|
31 | |||
32 | 3 | public function nack(string $deliveryTag, bool $multiple = false, bool $requeue = false) |
|
36 | |||
37 | 2 | public function consume(Consumable $consumable) : ChannelInterface |
|
53 | |||
54 | 2 | public function publish(Publishable $message) : ChannelInterface |
|
73 | |||
74 | /** |
||
75 | * @param $prefetchSize |
||
76 | * @param int $prefetchCount |
||
77 | * @param $aGlobal |
||
78 | * |
||
79 | * @return mixed |
||
80 | */ |
||
81 | 1 | public function basicQos($prefetchSize = null, int $prefetchCount = 1, $aGlobal = null) |
|
87 | |||
88 | 2 | View Code Duplication | public function declareQueue(Queue $queue) : ChannelInterface |
103 | |||
104 | 2 | public function bindQueue(Queue $queue) : ChannelInterface |
|
117 | |||
118 | 2 | View Code Duplication | public function declareExchange(Exchange $exchange) : ChannelInterface |
134 | |||
135 | /** |
||
136 | * @return array |
||
137 | */ |
||
138 | 2 | public function getCallbacks() : array |
|
142 | |||
143 | public function setCallbacks(array $callbacks = []) |
||
147 | |||
148 | /** |
||
149 | * @param Consumable $consumable |
||
150 | * |
||
151 | * @return AMQPMessage|null |
||
152 | */ |
||
153 | 1 | public function getMessage(Consumable $consumable) |
|
157 | |||
158 | 1 | public function getQueueSize(Queue $queue) : int |
|
173 | } |
||
174 |
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.