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 |
||
| 18 | class RqlFieldsCompilerPass implements CompilerPassInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var DocumentMap |
||
| 22 | */ |
||
| 23 | private $documentMap; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Make extref fields map and set it to parameter |
||
| 27 | * |
||
| 28 | * @param ContainerBuilder $container container builder |
||
| 29 | * @return void |
||
| 30 | */ |
||
| 31 | 4 | public function process(ContainerBuilder $container) |
|
| 59 | |||
| 60 | /** |
||
| 61 | * Get document class name from service |
||
| 62 | * |
||
| 63 | * @param Definition $service Service definition |
||
| 64 | * @param string $ns Bundle namespace |
||
| 65 | * @param string $bundle Bundle name |
||
| 66 | * @param string $doc Document name |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | 4 | View Code Duplication | private function getServiceDocument(Definition $service, $ns, $bundle, $doc) |
| 88 | } |
||
| 89 |