RefreshIndex::__construct()   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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Matchish\ScoutElasticSearch\Jobs\Stages;
4
5
use Elasticsearch\Client;
6
use Matchish\ScoutElasticSearch\ElasticSearch\Index;
7
use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Refresh;
8
9
/**
10
 * @internal
11
 */
12
final class RefreshIndex
13
{
14
    /**
15
     * @var Index
16
     */
17
    private $index;
18
19
    /**
20
     * RefreshIndex constructor.
21
     * @param Index $index
22
     */
23 16
    public function __construct(Index $index)
24
    {
25 16
        $this->index = $index;
26 16
    }
27
28 14
    public function handle(Client $elasticsearch): void
29
    {
30 14
        $params = new Refresh($this->index->name());
31 14
        $elasticsearch->indices()->refresh($params->toArray());
32 14
    }
33
34 13
    public function estimate(): int
35
    {
36 13
        return 1;
37
    }
38
39 13
    public function title(): string
40
    {
41 13
        return 'Refreshing index';
42
    }
43
}
44