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 |
||
15 | class TranslationExtractor extends ContainerAware |
||
|
|||
16 | { |
||
17 | /** |
||
18 | * @var Finder |
||
19 | */ |
||
20 | private $finder; |
||
21 | |||
22 | /** |
||
23 | * @var Filesystem |
||
24 | */ |
||
25 | private $filesystem; |
||
26 | |||
27 | /** |
||
28 | * @var MessageCatalogue[] |
||
29 | */ |
||
30 | private $messageCatalogues = []; |
||
31 | |||
32 | /** |
||
33 | * @param Finder $finder |
||
34 | * @param Filesystem $filesystem |
||
35 | */ |
||
36 | 3 | public function __construct(Finder $finder, Filesystem $filesystem) |
|
41 | |||
42 | /** |
||
43 | * @param string $path |
||
44 | * @param string $format |
||
45 | * @param null|string $domain |
||
46 | * |
||
47 | * @return MessageCatalogue[] |
||
48 | */ |
||
49 | 3 | public function extract($path, $format, $domain = null) |
|
67 | |||
68 | /** |
||
69 | * @param MessageCatalogue $messageCatalogue |
||
70 | * @param string $language |
||
71 | */ |
||
72 | 3 | private function addMessageCatalogue(MessageCatalogue $messageCatalogue, $language) |
|
84 | |||
85 | /** |
||
86 | * @param string $format |
||
87 | * |
||
88 | * @return LoaderInterface |
||
89 | */ |
||
90 | 3 | View Code Duplication | private function getLoader($format) |
100 | } |
||
101 |
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.