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 |
||
11 | View Code Duplication | abstract class PeriodicEndpoint extends Endpoint |
|
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $plural = "summaries"; |
||
18 | |||
19 | /** |
||
20 | * {@inheritDoc} |
||
21 | */ |
||
22 | protected function buildSpecificEntryUrl($id) |
||
29 | |||
30 | /** |
||
31 | * {@inheritDoc} |
||
32 | */ |
||
33 | protected function buildListUrl() |
||
39 | |||
40 | /** |
||
41 | * {@inheritDoc} |
||
42 | */ |
||
43 | protected function buildRecentUrl() |
||
50 | } |
||
51 |