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 |
||
9 | View Code Duplication | class InvalidStatusException extends InvalidArgumentException |
|
10 | { |
||
11 | /** |
||
12 | * InvalidStatusException constructor. |
||
13 | * @param string $status the invalid status id that was supplied |
||
14 | * @param string $domain the name of the domain, model, or class that the status belongs to |
||
15 | * @param string $message custom message |
||
16 | * @param int $code |
||
17 | * @param Exception|null $previous |
||
18 | */ |
||
19 | public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null) |
||
33 | } |
||
34 |