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 |
||
24 | View Code Duplication | class InvalidateTagCommand extends BaseInvalidateCommand |
|
25 | { |
||
26 | protected static $defaultName = 'fos:httpcache:invalidate:tag'; |
||
27 | |||
28 | /** |
||
29 | * If no cache manager is specified explicitly, fos_http_cache.cache_manager |
||
30 | * is automatically loaded. |
||
31 | * |
||
32 | * @param CacheManager|null $cacheManager The cache manager to talk to |
||
33 | */ |
||
34 | 4 | public function __construct(CacheManager $cacheManager = null, $commandName = 'fos:httpcache:invalidate:tag') |
|
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 4 | protected function configure() |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 2 | protected function execute(InputInterface $input, OutputInterface $output) |
|
76 | } |
||
77 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.