Grid   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 57
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1
ccs 0
cts 25
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A execute() 0 5 1
A getResultPage() 0 7 2
A _setPageData() 0 7 1
1
<?php
2
/**
3
 * File: Grid.php
4
 *
5
 * @author      Maciej Sławik <[email protected]>
6
 * Github:      https://github.com/maciejslawik
7
 */
8
9
namespace MSlwk\ICatalogue\Controller\Adminhtml\Catalogue;
10
11
use Magento\Backend\App\Action\Context;
12
use Magento\Framework\View\Result\PageFactory;
13
use Magento\Framework\View\Result\Page;
14
15
/**
16
 * Class Grid
17
 *
18
 * @package MSlwk\ICatalogue\Controller\Adminhtml\Catalogue
19
 */
20
class Grid extends ActionAbstract
21
{
22
    /**
23
     * @var bool|PageFactory
24
     */
25
    protected $resultPageFactory = false;
26
27
    /**
28
     * @var Page
29
     */
30
    protected $resultPage;
31
32
    /**
33
     * Grid constructor.
34
     *
35
     * @param Context $context
36
     * @param PageFactory $resultPageFactory
37
     */
38
    public function __construct(
39
        Context $context,
40
        PageFactory $resultPageFactory
41
    ) {
42
        parent::__construct($context);
43
        $this->resultPageFactory = $resultPageFactory;
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49
    public function execute()
50
    {
51
        $this->_setPageData();
52
        return $this->getResultPage();
53
    }
54
55
    /**
56
     * @return mixed
57
     */
58
    public function getResultPage()
59
    {
60
        if (is_null($this->resultPage)) {
61
            $this->resultPage = $this->resultPageFactory->create();
62
        }
63
        return $this->resultPage;
64
    }
65
66
    /**
67
     * @return $this
68
     */
69
    protected function _setPageData()
70
    {
71
        $resultPage = $this->getResultPage();
72
        $resultPage->getConfig()->getTitle()->prepend((__('Catalogues')));
73
74
        return $this;
75
    }
76
}
77