Completed
Pull Request — master (#10)
by Gordon
05:01
created

ReconfigureIndexesHelper::reconfigureIndexes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
1
<?php declare(strict_types = 1);
2
3
/**
4
 * Created by PhpStorm.
5
 * User: gordon
6
 * Date: 11/4/2561
7
 * Time: 16:22 น.
8
 */
9
10
namespace Suilven\ManticoreSearch\Helper;
11
12
use Suilven\FreeTextSearch\Factory\IndexCreatorFactory;
13
14
class ReconfigureIndexesHelper
15
{
16
    /** @param array<\Suilven\FreeTextSearch\Index> $indexes */
17
    public function reconfigureIndexes(array $indexes): void
18
    {
19
        $factory = new IndexCreatorFactory();
20
        $indexCreator = $factory->getIndexCreator();
21
22
        /** @var \Suilven\FreeTextSearch\Index $indexObj */
23
        foreach ($indexes as $indexObj) {
24
            $indexCreator->createIndex($indexObj->getName());
25
26
27
            // need to override sort, set it to null
28
            //Config::modify()->set($className, 'default_sort', null);
29
        }
30
    }
31
}
32