Passed
Push — master ( 8e5e71...e1daed )
by Mikołaj
03:31
created

ShopProductsFinder::find()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag. 
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project. 
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected]. 
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusElasticsearchPlugin\Finder;
14
15
use BitBag\SyliusElasticsearchPlugin\QueryBuilder\QueryBuilderInterface;
16
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
17
18
final class ShopProductsFinder implements FinderInterface
19
{
20
    /**
21
     * @var QueryBuilderInterface
22
     */
23
    private $shopProductsQueryBuilder;
24
25
    /**
26
     * @var PaginatedFinderInterface
27
     */
28
    private $productFinder;
29
30
    /**
31
     * @param QueryBuilderInterface $shopProductsQueryBuilder
32
     * @param PaginatedFinderInterface $productFinder
33
     */
34
    public function __construct(
35
        QueryBuilderInterface $shopProductsQueryBuilder,
36
        PaginatedFinderInterface $productFinder
37
    )
38
    {
39
        $this->shopProductsQueryBuilder = $shopProductsQueryBuilder;
40
        $this->productFinder = $productFinder;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function find(array $data): array
47
    {
48
        $query = $this->shopProductsQueryBuilder->buildQuery($data);
49
        $result = $this->productFinder->find($query);
50
51
        return $result;
52
    }
53
}
54