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

IndexMappingProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
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