PurgeWildcardForce::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * File: PurgeWildcardForce.php
7
 *
8
 * @author Maciej Sławik <[email protected]>
9
 * @copyright Copyright (C) 2019 Lizard Media (http://lizardmedia.pl)
10
 */
11
12
namespace LizardMedia\VarnishWarmer\Controller\Adminhtml\Purge;
13
14
use LizardMedia\VarnishWarmer\Console\Command\PurgeWildcardWithoutRegenerationCommand;
15
use LizardMedia\VarnishWarmer\Controller\Adminhtml\Purge;
16
use Magento\Framework\Controller\Result\Redirect;
17
18
/**
19
 * Class PurgeWildcardForce
20
 * @package LizardMedia\VarnishWarmer\Controller\Adminhtml\Purge
21
 */
22
class PurgeWildcardForce extends Purge
23
{
24
    /**
25
     * @return Redirect
26
     */
27
    public function execute(): Redirect
28
    {
29
        $this->runCommand();
30
        $this->addProcessNotification();
31
32
        return $this->getRedirect();
33
    }
34
35
    /**
36
     * @return void
37
     */
38
    protected function addProcessNotification(): void
39
    {
40
        $this->messageManager->addNoticeMessage(
41
            __('LizardMedia: cache is purged in background, it may take up to 20 seconds.')
42
        );
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    protected function getCliCommand(): string
49
    {
50
        return PurgeWildcardWithoutRegenerationCommand::CLI_COMMAND;
51
    }
52
}
53