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 |
||
31 | View Code Duplication | class SimpleBusDoctrineORMBridgeExtension extends Extension implements PrependExtensionInterface, SimpleBusTaggerExtension |
|
32 | { |
||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function load(array $configs, ContainerBuilder $container) |
||
37 | { |
||
38 | $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
||
39 | |||
40 | $loader->load('doctrine_orm.yml'); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function prepend(ContainerBuilder $container) |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function addMiddlewareTags(ContainerBuilder $container, $user) |
||
68 | } |
||
69 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.