Passed
Push — trunk ( 9dfcf5...f40966 )
by Christian
12:13 queued 13s
created

IndexMappingProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 5 1
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Elasticsearch\Framework\Indexing;
4
5
use Shopware\Core\Framework\Context;
6
use Shopware\Core\Framework\Log\Package;
7
use Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition;
8
9
#[Package('core')]
10
class IndexMappingProvider
11
{
12
    /**
13
     * @internal
14
     *
15
     * @param array<mixed> $mapping
16
     */
17
    public function __construct(
18
        private readonly array $mapping,
19
    ) {
20
    }
21
22
    /**
23
     * @return array<mixed>
24
     */
25
    public function build(AbstractElasticsearchDefinition $definition, Context $context): array
26
    {
27
        $mapping = $definition->getMapping($context);
28
29
        return array_merge_recursive($mapping, $this->mapping);
30
    }
31
}
32