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 |
||
17 | View Code Duplication | class SendDataException extends TransferException |
|
18 | { |
||
19 | /** |
||
20 | * Creates data sending failure |
||
21 | * |
||
22 | * @param SocketInterface $socket Socket with error |
||
23 | * |
||
24 | * @return SendDataException |
||
25 | */ |
||
26 | 6 | public static function failedToSendData(SocketInterface $socket) |
|
30 | |||
31 | /** |
||
32 | * @inheritDoc |
||
33 | */ |
||
34 | 9 | public function __construct( |
|
42 | } |
||
43 |