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 |
||
| 19 | class Console extends \Symfony\Component\Console\Application |
||
| 20 | { |
||
| 21 | use EnableDIAnnotations; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @inject |
||
| 25 | * @var ConsoleContainerBuilder |
||
| 26 | */ |
||
| 27 | protected $consoleContainerBuilder; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param FactoryInterface $factory |
||
| 31 | * @return Console |
||
| 32 | * @throws \DI\DependencyException |
||
| 33 | * @throws \DI\NotFoundException |
||
| 34 | */ |
||
| 35 | static public function create(FactoryInterface $factory) |
||
| 39 | /** |
||
| 40 | * @param $className |
||
| 41 | * @throws \Exception |
||
| 42 | */ |
||
| 43 | 1 | public function loadCommandsFromClass($className) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @param $fromPath |
||
| 60 | * @param string $namespace |
||
| 61 | * @throws \Exception |
||
| 62 | */ |
||
| 63 | View Code Duplication | public function loadRoutesFromPath($fromPath, $namespace = '') |
|
| 88 | |||
| 89 | } |