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 |
||
| 21 | class ACPDashboardController extends AbstractACPController |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Shows the dashboard/landing site of the ACP. |
||
| 25 | * |
||
| 26 | * @return Response |
||
| 27 | */ |
||
| 28 | public function indexAction() |
||
| 29 | { |
||
| 30 | $this->assignVariables(); |
||
| 31 | |||
| 32 | return $this->render( |
||
| 33 | 'TwoMartensCoreBundle:ACPDashboard:index.html.twig', |
||
| 34 | $this->templateVariables |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | protected function setBreadcrumbs() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | View Code Duplication | protected function assignVariables() |
|
| 67 | } |
||
| 68 |