SearchDependencyProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 11
c 0
b 0
f 0
dl 0
loc 45
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createSearchConfigBuilderPlugin() 0 3 1
A createSearchConfigExpanderPlugins() 0 7 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\ProductSearchConfigStorage\Plugin\Config\ProductSearchConfigExpanderPlugin;
15
use Spryker\Client\Search\Dependency\Plugin\SearchConfigBuilderInterface;
16
use Spryker\Client\Search\SearchDependencyProvider as SprykerSearchDependencyProvider;
17
use Spryker\Client\SearchElasticsearch\Plugin\ElasticsearchSearchAdapterPlugin;
18
use Spryker\Client\SearchElasticsearch\Plugin\ElasticsearchSearchContextExpanderPlugin;
19
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchAdapterPlugin;
20
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchContextExpanderPlugin;
21
22
class SearchDependencyProvider extends SprykerSearchDependencyProvider
23
{
24
    /**
25
     * @param \Spryker\Client\Kernel\Container $container
26
     *
27
     * @return \Spryker\Client\Search\Dependency\Plugin\SearchConfigBuilderInterface
28
     */
29
    protected function createSearchConfigBuilderPlugin(Container $container): SearchConfigBuilderInterface // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
30
    {
31
        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

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