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