Passed
Push — master ( ca7167...276d5c )
by Fabian
06:10
created

UserEditTab::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 5
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: willi
5
 * Date: 10.03.18
6
 * Time: 17:54
7
 */
8
9
namespace Firegento\DevDashboard\Block;
10
11
12
class UserEditTab  extends \Magento\Backend\Block\Widget\Form\Generic
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Block\Widget\Form\Generic was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
{
14
    /** @var \Firegento\DevDashboard\Model\ConfigRepository */
15
    protected $_configRepository;
16
17
    /**
18
     * @param \Magento\Backend\Block\Template\Context $context
19
     * @param \Magento\Framework\Registry $registry
20
     * @param \Magento\Framework\Data\FormFactory $formFactory
21
     * @param \Firegento\DevDashboard\Model\ConfigRepository
22
     * @param array $data
23
     */
24
    public function __construct(
25
        \Magento\Backend\Block\Template\Context $context,
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Block\Template\Context was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
        \Magento\Framework\Registry $registry,
27
        \Magento\Framework\Data\FormFactory $formFactory,
28
        \Firegento\DevDashboard\Model\ConfigRepository $configRepository,
29
        array $data = []
30
    ) {
31
        $this->_configRepository = $configRepository;
32
33
        parent::__construct($context, $registry, $formFactory, $data);
34
    }
35
36
    protected function _prepareForm()
37
    {
38
        /** @var $model \Magento\User\Model\User */
39
        $model = $this->_coreRegistry->registry('permissions_user');
40
41
        /** @var \Magento\Framework\Data\Form $form */
42
        $form = $this->_formFactory->create();
43
        $form->setHtmlIdPrefix('devdashboard_');
44
45
        $baseFieldset = $form->addFieldset('base_fieldset', ['legend' => __('Dashboard Configuration')]);
0 ignored issues
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

45
        $baseFieldset = $form->addFieldset('base_fieldset', ['legend' => /** @scrutinizer ignore-call */ __('Dashboard Configuration')]);
Loading history...
46
47
48
        $config = $this->_configRepository->getByUserId($model->getId() ? $model->getId() : null);
49
50
        $baseFieldset->addField(
51
            'configuration',
52
            'textarea',
53
            [
54
                'name' => 'configuration',
55
                'label' => __('Configuration'),
56
                'id' => 'configuration',
57
                'title' => __('Configuration'),
58
                'required' => false
59
            ]
60
        );
61
62
        $baseFieldset->addField(
63
            'use_devdashboard',
64
            'select',
65
            [
66
                'name' => 'use_devdashboard',
67
                'label' => __('Use developer dashboard as default'),
68
                'id' => 'use_devdashboard',
69
                'title' => __('Use developer dashboard'),
70
                'class' => 'input-select',
71
                'options' => ['1' => __('Yes'), '0' => __('No')]
72
            ]
73
        );
74
75
        $data = $config->getData();
76
        $form->setValues($data);
77
78
        $this->setForm($form);
79
80
        return parent::_prepareForm();
81
    }
82
83
}