SearchDependencyProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 13
c 0
b 0
f 0
dl 0
loc 47
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createSearchConfigBuilderPlugin() 0 3 1
A createSearchConfigExpanderPlugins() 0 9 1
A getClientAdapterPlugins() 0 5 1
A getSearchContextExpanderPlugins() 0 5 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace Pyz\Client\Search;
11
12
use Spryker\Client\Catalog\Plugin\Config\CatalogSearchConfigBuilder;
13
use Spryker\Client\Kernel\Container;
14
use Spryker\Client\MerchantProductOfferSearch\Plugin\Search\MerchantNameSearchConfigExpanderPlugin;
15
use Spryker\Client\MerchantProductSearch\Plugin\Search\MerchantProductMerchantNameSearchConfigExpanderPlugin;
16
use Spryker\Client\ProductSearchConfigStorage\Plugin\Config\ProductSearchConfigExpanderPlugin;
17
use Spryker\Client\Search\Dependency\Plugin\SearchConfigBuilderInterface;
18
use Spryker\Client\Search\SearchDependencyProvider as SprykerSearchDependencyProvider;
19
use Spryker\Client\SearchElasticsearch\Plugin\ElasticsearchSearchAdapterPlugin;
20
use Spryker\Client\SearchElasticsearch\Plugin\ElasticsearchSearchContextExpanderPlugin;
21
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchAdapterPlugin;
22
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchContextExpanderPlugin;
23
24
class SearchDependencyProvider extends SprykerSearchDependencyProvider
25
{
26
    /**
27
     * @param \Spryker\Client\Kernel\Container $container
28
     *
29
     * @return \Spryker\Client\Search\Dependency\Plugin\SearchConfigBuilderInterface
30
     */
31
    protected function createSearchConfigBuilderPlugin(Container $container): SearchConfigBuilderInterface // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
32
    {
33
        return new CatalogSearchConfigBuilder();
0 ignored issues
show
Deprecated Code introduced by
The class Spryker\Client\Catalog\P...alogSearchConfigBuilder has been deprecated: Use {@link \Spryker\Client\Catalog\Plugin\SearchElasticsearch\ElasticsearchCatalogSearchConfigBuilderPlugin} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

33
        return /** @scrutinizer ignore-deprecated */ new CatalogSearchConfigBuilder();
Loading history...
34
    }
35
36
    /**
37
     * @param \Spryker\Client\Kernel\Container $container
38
     *
39
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\SearchConfigExpanderPluginInterface>
40
     */
41
    protected function createSearchConfigExpanderPlugins(Container $container): array
42
    {
43
        $searchConfigExpanderPlugins = parent::createSearchConfigExpanderPlugins($container);
44
45
        $searchConfigExpanderPlugins[] = new ProductSearchConfigExpanderPlugin();
46
        $searchConfigExpanderPlugins[] = new MerchantNameSearchConfigExpanderPlugin();
47
        $searchConfigExpanderPlugins[] = new MerchantProductMerchantNameSearchConfigExpanderPlugin();
48
49
        return $searchConfigExpanderPlugins;
50
    }
51
52
    /**
53
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\SearchAdapterPluginInterface>
54
     */
55
    protected function getClientAdapterPlugins(): array
56
    {
57
        return [
58
            new SearchHttpSearchAdapterPlugin(),
59
            new ElasticsearchSearchAdapterPlugin(),
60
        ];
61
    }
62
63
    /**
64
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\SearchContextExpanderPluginInterface>
65
     */
66
    protected function getSearchContextExpanderPlugins(): array
67
    {
68
        return [
69
            new SearchHttpSearchContextExpanderPlugin(),
70
            new ElasticsearchSearchContextExpanderPlugin(),
71
        ];
72
    }
73
}
74