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 | View Code Duplication | class ErrorResponse extends Response implements UriAwareResponse, RequestAwareResponse |
|
11 | { |
||
12 | /** |
||
13 | * @var RequestInterface |
||
14 | */ |
||
15 | private $request; |
||
16 | |||
17 | private $errorMessage = ''; |
||
18 | |||
19 | public function getUri() |
||
23 | |||
24 | public function setRequest(RequestInterface $request) |
||
28 | |||
29 | public function getRequest() |
||
33 | |||
34 | public function setErrorMessage($errorMessage) |
||
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getErrorMessage() |
||
46 | } |
||
47 |