Form::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
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: Form.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\PurgeSingle;
13
14
use Magento\Backend\App\Action;
15
use Magento\Backend\App\Action\Context;
16
use Magento\Backend\Model\View\Result\Page;
17
use Magento\Framework\App\ResponseInterface;
18
use Magento\Framework\Controller\ResultInterface;
19
use Magento\Framework\View\Result\PageFactory;
20
21
/**
22
 * Class Form
23
 * @package LizardMedia\VarnishWarmer\Controller\Adminhtml\Form
24
 */
25 View Code Duplication
class Form extends Action
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
26
{
27
    /**
28
     * @var PageFactory
29
     */
30
    protected $resultPageFactory;
31
32
    /**
33
     * @param Action\Context $context
34
     * @param PageFactory $resultPageFactory
35
     */
36
    public function __construct(
37
        Context $context,
38
        PageFactory $resultPageFactory
39
    ) {
40
        $this->resultPageFactory = $resultPageFactory;
41
        parent::__construct($context);
42
    }
43
44
    /**
45
     * @return Page
46
     */
47
    public function execute(): Page
48
    {
49
        $resultPage = $this->initAction();
50
        $resultPage->getConfig()->getTitle()->prepend(__('Varnish: purge single URL'));
51
        return $resultPage;
52
    }
53
54
    /**
55
     * @return Page
56
     */
57
    protected function initAction(): Page
58
    {
59
        /** @var Page $resultPage */
60
        $resultPage = $this->resultPageFactory->create();
61
        $resultPage->setActiveMenu('LizardMedia_VarnishWarmer::form_purge_single');
62
        return $resultPage;
63
    }
64
}
65