CustomerMap   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
c 2
b 0
f 0
dl 0
loc 44
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toOptionArray() 0 16 3
A __construct() 0 6 1
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
use Magento\Customer\Model\Customer;
0 ignored issues
show
Bug introduced by
The type Magento\Customer\Model\Customer 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...
12
use Magento\Framework\ObjectManagerInterface;
0 ignored issues
show
Bug introduced by
The type Magento\Framework\ObjectManagerInterface 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
/**
15
 * Class CustomerMap - Maps customer attributes.
16
 */
17
class CustomerMap implements \Magento\Framework\Option\ArrayInterface
0 ignored issues
show
Bug introduced by
The type Magento\Framework\Option\ArrayInterface 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...
18
{
19
    /**
20
     * @var objectManager
0 ignored issues
show
Bug introduced by
The type Moip\Magento2\Block\Admi...em\Config\objectManager 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
     */
22
    protected $objectManager;
23
24
    /**
25
     * @var customer
26
     */
27
    protected $customer;
28
29
    /**
30
     * @param ObjectManagerInterface $objectManager
31
     */
32
    public function __construct(
33
        ObjectManagerInterface $objectManager,
34
        Customer $customer
35
    ) {
36
        $this->objectManager = $objectManager;
37
        $this->customer = $customer;
38
    }
39
40
    /**
41
     * Returns Options.
42
     *
43
     * @return array | attributesArrays
0 ignored issues
show
Bug introduced by
The type Moip\Magento2\Block\Admi...Config\attributesArrays 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...
44
     */
45
    public function toOptionArray()
46
    {
47
        $customer_attributes = $this->customer->getAttributes();
48
        $attributesArrays = [];
49
        $attributesArrays[] = ['label' => __('Please select'), 'value' => null];
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

49
        $attributesArrays[] = ['label' => /** @scrutinizer ignore-call */ __('Please select'), 'value' => null];
Loading history...
50
51
        foreach ($customer_attributes as $atribute => $val) {
52
            if ($val) {
53
                $attributesArrays[] = [
54
                    'label' => $atribute,
55
                    'value' => $atribute,
56
                ];
57
            }
58
        }
59
60
        return $attributesArrays;
61
    }
62
}
63