AttributeMapImportMap::getMap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 15
c 2
b 0
f 1
nc 1
nop 0
dl 0
loc 20
rs 9.7666
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Mapper\Map;
9
10
use SprykerMiddleware\Zed\Process\Business\Mapper\Map\AbstractMap;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Zed\Pr...\Mapper\Map\AbstractMap 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...
11
use SprykerMiddleware\Zed\Process\Business\Mapper\Map\MapInterface;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Zed\Pr...Mapper\Map\MapInterface 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
13
class AttributeMapImportMap extends AbstractMap
14
{
15
    /**
16
     * @var array
17
     */
18
    protected const ATTRIBUTE_MAP = [
19
        'pim_catalog_boolean' => 'number',
20
        'pim_catalog_textarea' => 'textarea',
21
        'pim_catalog_text' => 'text',
22
        'pim_catalog_simpleselect' => 'select',
23
        'pim_reference_data_multiselect' => 'text',
24
        'pim_catalog_price_collection' => 'text',
25
        'pim_catalog_number' => 'number',
26
        'pim_catalog_multiselect' => 'text',
27
        'pim_catalog_metric' => 'text',
28
        'pim_catalog_image' => 'text',
29
        'pim_catalog_identifier' => 'text',
30
        'pim_catalog_file' => 'text',
31
        'pim_catalog_date' => 'date',
32
        'pim_assets_collection' => 'text',
33
        'pim_catalog_asset_collection' => 'text',
34
        'akeneo_reference_entity' => 'text',
35
    ];
36
37
    /**
38
     * @return array
39
     */
40
    public function getMap(): array
41
    {
42
        return [
43
            'attribute_key' => 'code',
44
            'key' => 'code',
45
            'allow_input' => function () {
46
                return false;
47
            },
48
            'is_multiple' => function () {
49
                return false;
50
            },
51
            'input_type' => function ($value) {
52
                return static::ATTRIBUTE_MAP[$value['type']];
53
            },
54
            'type' => 'type',
55
            'group' => 'group',
56
            'options' => 'options',
57
            'is_super' => 'is_super',
58
            'localizedAttributes' => 'labels',
59
            'localizable' => 'localizable',
60
        ];
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getStrategy(): string
67
    {
68
        return MapInterface::MAPPER_STRATEGY_SKIP_UNKNOWN;
69
    }
70
}
71