Indexer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 39
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createIndizes() 0 6 2
A __construct() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Elasticsearch\Business\Model;
5
6
7
use Elastica\Client;
8
use Xervice\Elasticsearch\Business\Collection\IndexCollection;
9
use Xervice\Elasticsearch\Business\Model\Index\IndexBuilderInterface;
10
use Xervice\Elasticsearch\Business\Model\Index\MappingConverterInterface;
11
12
class Indexer implements IndexerInterface
13
{
14
    /**
15
     * @var \Xervice\Elasticsearch\Business\Collection\IndexCollection
16
     */
17
    private $indexCollection;
18
19
    /**
20
     * @var \Xervice\Elasticsearch\Business\Model\Index\IndexBuilderInterface
21
     */
22
    private $indexBuilder;
23
24
    /**
25
     * @var \Xervice\Elasticsearch\Business\Model\Index\MappingConverterInterface
26
     */
27
    private $mappingConverter;
28
29
    /**
30
     * Indexer constructor.
31
     *
32
     * @param \Xervice\Elasticsearch\Business\Collection\IndexCollection $indexCollection
33
     * @param \Xervice\Elasticsearch\Business\Model\Index\IndexBuilderInterface $indexBuilder
34
     */
35 4
    public function __construct(
36
        IndexCollection $indexCollection,
37
        IndexBuilderInterface $indexBuilder,
38
        MappingConverterInterface $mappingConverter
39
    ) {
40 4
        $this->indexCollection = $indexCollection;
41 4
        $this->indexBuilder = $indexBuilder;
42 4
        $this->mappingConverter = $mappingConverter;
43 4
    }
44
45 4
    public function createIndizes(): void
46
    {
47 4
        foreach ($this->indexCollection as $indexProvider) {
48 3
            $indexProvider->createIndex(
49 3
                $this->indexBuilder,
50 3
                $this->mappingConverter
51
            );
52
        }
53 4
    }
54
}
55