Passed
Push — master ( da73f3...744736 )
by
unknown
03:19 queued 12s
created

Label::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Payone\Core\Block\Adminhtml\Config\Form\Field;
4
5
class Label extends \Magento\Config\Block\System\Config\Form\Field
0 ignored issues
show
Bug introduced by
The type Magento\Config\Block\System\Config\Form\Field 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...
6
{
7
    /**
8
     * Payone Base Helper
9
     *
10
     * @var \Payone\Core\Helper\Base
11
     */
12
    protected $baseHelper;
13
14
    /**
15
     * @param \Magento\Backend\Block\Template\Context $context
16
     * @param \Payone\Core\Helper\Base                $baseHelper
17
     * @param array                                   $data
18
     */
19
    public function __construct(
20
        \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...
21
        \Payone\Core\Helper\Base $baseHelper,
22
        array $data = []
23
    ) {
24
        parent::__construct($context, $data);
25
        $this->baseHelper = $baseHelper;
26
    }
27
28
    /**
29
     * Check if inheritance checkbox has to be rendered
30
     *
31
     * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
32
     * @return bool
33
     */
34
    protected function _isInheritCheckboxRequired(\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
    {
36
        return false;
37
    }
38
39
    /**
40
     * Render scope label
41
     *
42
     * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
43
     * @return string
44
     */
45
    protected function _renderScopeLabel(\Magento\Framework\Data\Form\Element\AbstractElement $element)
46
    {
47
        return '';
48
    }
49
50
    /**
51
     * Determine if label has to be shown
52
     *
53
     * @return bool
54
     */
55
    protected function showElement()
56
    {
57
        if ($this->baseHelper->getConfigParamByPath("customer/address/dob_show") == "req" && $this->baseHelper->getConfigParamByPath("customer/address/gender_show") == "req") {
58
            return false;
59
        }
60
        return true;
61
    }
62
63
    /**
64
     * Render element value
65
     *
66
     * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
67
     * @return string
68
     */
69
    protected function _renderValue(\Magento\Framework\Data\Form\Element\AbstractElement $element)
70
    {
71
        $html = '<td class="value">';
72
        $html .= $this->_getElementHtml($element);
73
        if ($element->getComment()) {
74
            $html .= '<span style="color: red;"><strong>' . $element->getComment() . '</strong></span>';
75
        }
76
        $html .= '</td>';
77
        return $html;
78
    }
79
80
    /**
81
     * Retrieve HTML markup for given form element
82
     *
83
     * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
84
     * @return string
85
     */
86
    public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
87
    {
88
        if ($this->showElement() === false) {
89
            return '';
90
        }
91
        return parent::render($element);
92
    }
93
}
94