RefreshIndex   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A estimate() 0 3 1
A title() 0 3 1
A __construct() 0 3 1
A handle() 0 4 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