Passed
Branch master (ef2bc9)
by Fabian
04:26
created

src/Block/Adminhtml/Dashboard/Configuration.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Firegento\DevDashboard\Block\Adminhtml\Dashboard;
4
5
class Configuration extends \Magento\Config\Block\System\Config\Edit
6
{
7
8
    /**
9
     * @var mixed
10
     */
11
    public $originalParams;
12
13
    /**
14
     * Configuration constructor.
15
     *
16
     * @param \Magento\Backend\Block\Template\Context $context
17
     * @param \Magento\Config\Model\Config\Structure  $configStructure
18
     * @param array                                   $data
19
     */
20
    public function __construct(
21
        \Magento\Backend\Block\Template\Context $context,
22
        \Magento\Config\Model\Config\Structure $configStructure,
23
        array $data = []
24
    ) {
25
        parent::__construct($context, $configStructure, $data);
26
27
        $this->_prepareRequestParams();
28
        $this->setTitle(__('Developer configurations'));
0 ignored issues
show
The method setTitle() does not exist on Firegento\DevDashboard\B...Dashboard\Configuration. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        $this->/** @scrutinizer ignore-call */ 
29
               setTitle(__('Developer configurations'));
Loading history...
29
        $this->_resetRequestParams();
30
    }
31
32
    /**
33
     * @return $this
34
     */
35
    public function _prepareLayout()
36
    {
37
        $this->_prepareRequestParams();
38
        parent::_prepareLayout();
39
40
        return $this;
41
    }
42
43
    /**
44
     *
45
     */
46
    public function _prepareRequestParams()
47
    {
48
        $this->originalParams = $this->getRequest()->getParam('section');
49
        $this->getRequest()->setParam('section', 'dev');
0 ignored issues
show
The method setParam() does not exist on Magento\Framework\App\RequestInterface. Did you maybe mean setParams()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        $this->getRequest()->/** @scrutinizer ignore-call */ setParam('section', 'dev');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
    }
51
52
    /**
53
     *
54
     */
55
    public function _resetRequestParams()
56
    {
57
        $this->getRequest()->setParam('section', $this->originalParams);
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getSaveUrl()
64
    {
65
        return $this->getUrl('adminhtml/system_config/save', ['section' => 'dev']);
66
    }
67
}
68