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 RefreshPathCommand extends BaseInvalidateCommand |
|
25 | { |
||
26 | use PathSanityCheck; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $commandName; |
||
32 | |||
33 | /** |
||
34 | * If no cache manager is specified explicitly, fos_http_cache.cache_manager |
||
35 | * is automatically loaded. |
||
36 | * |
||
37 | * @param CacheManager|null $cacheManager The cache manager to talk to |
||
38 | * @param string $commandName Name of this command, in case you want to reuse it |
||
39 | */ |
||
40 | 10 | public function __construct(CacheManager $cacheManager = null, $commandName = 'fos:httpcache:refresh:path') |
|
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 10 | protected function configure() |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 3 | protected function execute(InputInterface $input, OutputInterface $output) |
|
85 | } |
||
86 |