Completed
Push — master ( 501145...c31d74 )
by GBProd
01:44
created

ReindexHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.6666
cc 1
eloc 5
nc 1
nop 3
crap 1
1
<?php
2
3
namespace GBProd\ElasticaExtraBundle\Handler;
4
5
use Elastica\Client;
6
use Elastica\Tool\CrossIndex;
7
8
/**
9
 * Handler for reindex
10
 *
11
 * @author gbprod <[email protected]>
12
 */
13
class ReindexHandler
14
{
15
    /**
16
     * @var string
17
     */
18
    public static $crossIndexClassname = CrossIndex::class;
19
20
    /**
21
     * Reindex handler
22
     *
23
     * @param Client $client
24
     * @param string $oldIndex
25
     * @param string $newIndex
26
     */
27 1
    public function handle(Client $client, $oldIndex, $newIndex)
28
    {
29 1
        $classname = self::$crossIndexClassname;
30
31 1
        $classname::reindex(
32 1
            $client->getIndex($oldIndex),
33 1
            $client->getIndex($newIndex)
34 1
        );
35 1
    }
36
}
37