ElasticsearchMapping::getEsClient()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Triadev\Es\Mapping;
3
4
use Elasticsearch\Client;
5
use Triadev\Es\Contract\ElasticsearchContract;
6
use Triadev\Es\Mapping\Contract\ElasticsearchMappingContract;
7
use Triadev\Es\Mapping\Mapping\Blueprint;
8
9
class ElasticsearchMapping implements ElasticsearchMappingContract
10
{
11
    /**
12
     * Get es client
13
     *
14
     * @return Client
15
     */
16 3
    public function getEsClient(): Client
17
    {
18 3
        return app(ElasticsearchContract::class)->getClient();
19
    }
20
    
21
    /**
22
     * Map
23
     *
24
     * @param \Closure $blueprint
25
     * @param string $esIndex
26
     * @param string $esType
27
     */
28 2
    public function map(\Closure $blueprint, string $esIndex, string $esType)
29
    {
30 2
        $blueprintMapping = new Blueprint();
31 2
        $blueprint($blueprintMapping);
32
    
33 2
        $blueprintMapping->build($esIndex, $esType);
34 2
    }
35
}
36