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 |
||
24 | class GuzzleHttpAdapter implements AdapterInterface |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var ClientInterface |
||
29 | */ |
||
30 | protected $client; |
||
31 | |||
32 | /** |
||
33 | * @var Response|ResponseInterface |
||
34 | */ |
||
35 | protected $response; |
||
36 | |||
37 | /** |
||
38 | * @param string $username |
||
39 | * @param string $password |
||
40 | * @param string $accept |
||
41 | * @param ClientInterface|null $client |
||
42 | */ |
||
43 | public function __construct($username, $password, $accept, ClientInterface $client = null) |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | View Code Duplication | public function get($url) |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | View Code Duplication | public function delete($url) |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | View Code Duplication | public function put($url, $content = '') |
|
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | View Code Duplication | public function post($url, $content = '') |
|
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | View Code Duplication | public function getLatestResponseHeaders() |
|
133 | |||
134 | /** |
||
135 | * @throws HttpException |
||
136 | */ |
||
137 | View Code Duplication | protected function handleError() |
|
144 | } |
||
145 |
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.