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 TwigStakxBridge implements TemplateBridgeInterface |
||
17 | { |
||
18 | private $twig; |
||
19 | private $logger; |
||
20 | |||
21 | /** @var \Twig_Profiler_Profile */ |
||
22 | private $profiler; |
||
23 | |||
24 | 79 | public function __construct(Environment $twig) |
|
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function setLogger(LoggerInterface $logger) |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 12 | public function setGlobalVariable($key, $value) |
|
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public function clearTemplateCache() |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 12 | public function createTemplate($templateContent) |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 24 | View Code Duplication | public function getAssortmentDependencies($namespace, $bodyContent) |
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 7 | View Code Duplication | public function getTemplateImportDependencies($bodyContent) |
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function hasProfiler() |
||
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 48 | public function setProfiler($profiler) |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | public function getProfilerOutput(Compiler $compiler) |
||
130 | } |
||
131 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.