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 |
||
18 | View Code Duplication | class NotFoundException extends HttpException |
|
19 | { |
||
20 | /** |
||
21 | * {@inheritDoc} |
||
22 | */ |
||
23 | protected $_defaultCode = 404; |
||
24 | |||
25 | /** |
||
26 | * Constructor |
||
27 | * |
||
28 | * @param string|null $message If no message is given 'Not Found' will be the message |
||
29 | * @param int $code Status code, defaults to 404 |
||
30 | * @param \Exception|null $previous The previous exception. |
||
31 | */ |
||
32 | public function __construct($message = null, $code = null, $previous = null) |
||
39 | } |
||
40 |