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 |
||
16 | class VotingController extends Controller |
||
|
|||
17 | { |
||
18 | /** |
||
19 | * @Route("/voting-upvote", name="voting_upvote") |
||
20 | * @Template("KunstmaanVotingBundle:UpDown:voted.html.twig") |
||
21 | * |
||
22 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
23 | */ |
||
24 | View Code Duplication | public function upVoteAction(Request $request) |
|
32 | |||
33 | /** |
||
34 | * @Route("/voting-downvote", name="voting_downvote") |
||
35 | * @Template("KunstmaanVotingBundle:UpDown:voted.html.twig") |
||
36 | * |
||
37 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
38 | */ |
||
39 | View Code Duplication | public function downVoteAction(Request $request) |
|
47 | |||
48 | /** |
||
49 | * @Route("/voting-facebooklike", name="voting_facebooklike") |
||
50 | * |
||
51 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
52 | */ |
||
53 | public function facebookLikeAction(Request $request) |
||
59 | |||
60 | /** |
||
61 | * @Route("/voting-facebooksend", name="voting_facebooksend") |
||
62 | * |
||
63 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
64 | */ |
||
65 | public function facebookSendAction(Request $request) |
||
71 | |||
72 | /** |
||
73 | * @Route("/voting-linkedinshare", name="voting_linkedinshare") |
||
74 | * |
||
75 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
76 | */ |
||
77 | public function linkedInShareAction(Request $request) |
||
83 | } |
||
84 |
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.