These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * File: PurgeHomepageCommand.php |
||
4 | * |
||
5 | * @author Maciej Sławik <[email protected]> |
||
6 | * @copyright Copyright (C) 2019 Lizard Media (http://lizardmedia.pl) |
||
7 | */ |
||
8 | |||
9 | namespace LizardMedia\VarnishWarmer\Console\Command; |
||
10 | |||
11 | use Symfony\Component\Console\Input\InputInterface; |
||
12 | use Symfony\Component\Console\Input\InputOption; |
||
13 | use Symfony\Component\Console\Output\OutputInterface; |
||
14 | |||
15 | /** |
||
16 | * Class PurgeHomepageCommand |
||
17 | * @package LizardMedia\VarnishWarmer\Console\Command |
||
18 | */ |
||
19 | View Code Duplication | class PurgeHomepageCommand extends AbstractPurgeCommand |
|
0 ignored issues
–
show
|
|||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | const CLI_COMMAND = 'lm-varnish:cache-purge-homepage'; |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | protected function configure() |
||
30 | { |
||
31 | $this->setName(self::CLI_COMMAND) |
||
32 | ->setDescription('Purge: homepage; Regenerate: homepage') |
||
33 | ->addOption( |
||
34 | self::STORE_VIEW_ID, |
||
35 | null, |
||
36 | InputOption::VALUE_OPTIONAL |
||
37 | ); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | protected function execute(InputInterface $input, OutputInterface $output) |
||
44 | { |
||
45 | $this->varnishPurger->setStoreViewId((int) $input->getOption(self::STORE_VIEW_ID)); |
||
46 | $this->varnishPurger->purgeHomepage(); |
||
47 | } |
||
48 | } |
||
49 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.