Passed
Push[email protected] ( 6f3704 )
by Bruno
03:10
created

PaymentGroup::_isPaymentEnabled()   A

Complexity

Conditions 5
Paths 12

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 9
c 1
b 0
f 0
nc 12
nop 1
dl 0
loc 16
rs 9.6111
1
<?php
2
/**
3
 * Copyright © Wirecard Brasil. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See COPYING.txt for license details.
7
 */
8
9
namespace Moip\Magento2\Block\Adminhtml\System\Config;
10
11
/**
12
 * Class PaymentGroup - Fieldset renderer for moip.
13
 */
14
class PaymentGroup extends \Magento\Config\Block\System\Config\Form\Fieldset
0 ignored issues
show
Bug introduced by
The type Magento\Config\Block\System\Config\Form\Fieldset 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...
15
{
16
    /**
17
     * @param \Magento\Backend\Block\Context $context
18
     * @param \Magento\Backend\Model\Auth\Session $authSession
19
     * @param \Magento\Framework\View\Helper\Js $jsHelper
20
     * @param array $data
21
     */
22
    public function __construct(
23
        \Magento\Backend\Block\Context $context,
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Block\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...
24
        \Magento\Backend\Model\Auth\Session $authSession,
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Model\Auth\Session 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...
25
        \Magento\Framework\View\Helper\Js $jsHelper,
0 ignored issues
show
Bug introduced by
The type Magento\Framework\View\Helper\Js 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
        array $data = []
27
    ) {
28
        parent::__construct($context, $authSession, $jsHelper, $data);
29
    }
30
31
    /**
32
     * Return header comment part of html for fieldset
33
     *
34
     * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
0 ignored issues
show
Bug introduced by
The type Magento\Framework\Data\F...Element\AbstractElement 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...
35
     * @return string
36
     */
37
    protected function _getHeaderCommentHtml($element)
38
    {
39
        $groupConfig = $element->getGroup();
40
41
        if (empty($groupConfig['help_url']) || !$element->getComment()) {
42
            return parent::_getHeaderCommentHtml($element);
43
        }
44
45
        $html = '<div class="comment">' .
46
            $element->getComment() .
47
            ' <a target="_blank" href="' .
48
            $groupConfig['help_url'] .
49
            '">' .
50
            __(
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

50
            /** @scrutinizer ignore-call */ 
51
            __(
Loading history...
51
                'Help'
52
            ) . '</a></div>';
53
54
        return $html;
55
    }
56
57
    /**
58
     * Return collapse state
59
     *
60
     * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
61
     * @return bool
62
     */
63
    protected function _isCollapseState($element)
64
    {
65
        $extra = $this->_authSession->getUser()->getExtra();
66
        if (isset($extra['configState'][$element->getId()])) {
67
            return $extra['configState'][$element->getId()];
68
        }
69
70
        $groupConfig = $element->getGroup();
71
        if (!empty($groupConfig['expanded'])) {
72
            return true;
73
        }
74
75
        return false;
76
    }
77
}
78