Index   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 41
loc 41
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A execute() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

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
2
namespace LizardMedia\CronScheduler\Controller\Adminhtml\Configuration;
3
4
use Magento\Backend\Model\View\Result\Page;
5
use Magento\Framework\App\ResponseInterface;
6
use Magento\Framework\Controller\ResultInterface;
7
use Magento\Framework\View\Result\PageFactory;
8
use Magento\Backend\App\Action\Context;
9
use Magento\Backend\App\Action;
10
11
/**
12
 * Class Index
13
 * @package LizardMedia\CronScheduler\Controller\Adminhtml\Configuration
14
 */
15 View Code Duplication
class Index 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...
16
{
17
    /**
18
     * @const string
19
     */
20
    const ADMIN_RESOURCE = "LizardMedia_CronScheduler::cron_configuration";
21
    
22
    /**
23
     * @const string
24
     */
25
    const TITLE = 'Cron Jobs Configuration';
26
27
    /**
28
     * @var PageFactory
29
     */
30
    protected $resultPageFactory;
31
32
    /**
33
     * @param PageFactory $resultPageFactory
34
     * @param Context $context
35
     */
36
    public function __construct(
37
        PageFactory $resultPageFactory,
38
        Context $context
39
    ) {
40
        parent::__construct($context);
41
        $this->resultPageFactory = $resultPageFactory;
42
    }
43
44
    /**
45
     * @return Page|ResponseInterface|ResultInterface
46
     */
47
    public function execute()
48
    {
49
        /** @var Page $resultPage */
50
        $resultPage = $this->resultPageFactory->create();
51
        $resultPage->setActiveMenu(self::ADMIN_RESOURCE);
52
        $resultPage->getConfig()->getTitle()->prepend(__(self::TITLE));
53
        return $resultPage;
54
    }
55
}
56