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 MessageCatalogueWriter extends ContainerAware |
||
|
|||
13 | { |
||
14 | /** |
||
15 | * @var TranslationWriter |
||
16 | */ |
||
17 | private $translationWriter; |
||
18 | |||
19 | /** |
||
20 | * @param TranslationWriter $translationWriter |
||
21 | */ |
||
22 | 3 | public function __construct(TranslationWriter $translationWriter) |
|
26 | |||
27 | /** |
||
28 | * @param array $messageCatalogues |
||
29 | * @param string $format |
||
30 | * @param null|string $path |
||
31 | */ |
||
32 | 3 | public function write(array $messageCatalogues, $format, $path = null) |
|
43 | /** |
||
44 | * Returns Symfony requested format dumper |
||
45 | * |
||
46 | * @param string $format |
||
47 | * |
||
48 | * @return \Symfony\Component\Translation\Dumper\DumperInterface |
||
49 | * |
||
50 | * @throws \InvalidArgumentException |
||
51 | */ |
||
52 | 3 | View Code Duplication | private function getDumper($format) |
62 | |||
63 | /** |
||
64 | * Returns translation path |
||
65 | * |
||
66 | * @param string $outputPath |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 3 | private function getTranslationPath($outputPath = null) |
|
78 | } |
||
79 |
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.