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 |
||
12 | class SitemapController extends Controller |
||
|
|||
13 | { |
||
14 | /** |
||
15 | * This will generate a sitemap for the specified locale. |
||
16 | * Use the mode parameter to select in which mode the sitemap should be |
||
17 | * generated. At this moment only XML is supported |
||
18 | * |
||
19 | * @Route("/sitemap-{locale}.{_format}", name="KunstmaanSitemapBundle_sitemap", |
||
20 | * requirements={"_format" = "xml"}) |
||
21 | * @Template("@KunstmaanSitemap/Sitemap/view.xml.twig") |
||
22 | * |
||
23 | * @param $locale |
||
24 | * |
||
25 | * @return array |
||
26 | */ |
||
27 | public function sitemapAction($locale) |
||
44 | |||
45 | /** |
||
46 | * This will generate a sitemap index file to define a sub sitemap for each |
||
47 | * language. Info at: |
||
48 | * https://support.google.com/webmasters/answer/75712?rd=1 Use the mode |
||
49 | * parameter to select in which mode the sitemap should be generated. At |
||
50 | * this moment only XML is supported |
||
51 | * |
||
52 | * @Route("/sitemap.{_format}", name="KunstmaanSitemapBundle_sitemapindex", |
||
53 | * requirements={"_format" = "xml"}) |
||
54 | * @Template("@KunstmaanSitemap/SitemapIndex/view.xml.twig") |
||
55 | * |
||
56 | * @param Request $request |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public function sitemapIndexAction(Request $request) |
||
70 | |||
71 | /** |
||
72 | * @param object $event |
||
73 | * @param string $eventName |
||
74 | * |
||
75 | * @return object |
||
76 | */ |
||
77 | View Code Duplication | private function dispatch($event, string $eventName) |
|
88 | } |
||
89 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.