Form::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 2
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\PurgeMultiple;
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\View\Result\PageFactory;
18
19
/**
20
 * Class Form
21
 * @package LizardMedia\VarnishWarmer\Controller\Adminhtml\PurgeMultiple
22
 */
23 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...
24
{
25
    /**
26
     * @var PageFactory
27
     */
28
    protected $resultPageFactory;
29
30
    /**
31
     * @param Action\Context $context
32
     * @param PageFactory $resultPageFactory
33
     */
34
    public function __construct(
35
        Context $context,
36
        PageFactory $resultPageFactory
37
    ) {
38
        $this->resultPageFactory = $resultPageFactory;
39
        parent::__construct($context);
40
    }
41
42
    /**
43
     * @return Page
44
     */
45
    public function execute(): Page
46
    {
47
        $resultPage = $this->initAction();
48
        $resultPage->getConfig()->getTitle()->prepend(__('Varnish: purge group of URLs'));
49
        return $resultPage;
50
    }
51
52
    /**
53
     * @return Page
54
     */
55
    protected function initAction(): Page
56
    {
57
        /** @var Page $resultPage */
58
        $resultPage = $this->resultPageFactory->create();
59
        $resultPage->setActiveMenu('LizardMedia_VarnishWarmer::form_purge_multiple');
60
        return $resultPage;
61
    }
62
}
63