Completed
Push — master ( 59d977...e14570 )
by Kristof
07:01 queued 02:22
created

QueryNarrowingSearchService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace CultuurNet\UDB3\Search\Narrowing;
4
5
use CultuurNet\UDB3\Search\SearchServiceInterface;
6
7
class QueryNarrowingSearchService implements SearchServiceInterface
8
{
9
    /**
10
     * @var SearchServiceInterface
11
     */
12
    private $searchService;
13
14
    /**
15
     * @var QueryNarrowerInterface
16
     */
17
    private $queryNarrower;
18
19
    /**
20
     * QueryNarrowingSearchService constructor.
21
     *
22
     * @param SearchServiceInterface $searchService
23
     * @param QueryNarrowerInterface $queryNarrower
24
     */
25
    public function __construct(SearchServiceInterface $searchService, QueryNarrowerInterface $queryNarrower)
26
    {
27
        $this->searchService = $searchService;
28
        $this->queryNarrower = $queryNarrower;
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function search(string $query, $limit = 30, $start = 0, $sort = null)
35
    {
36
        $narrowedQuery = $this->queryNarrower->narrow($query);
37
38
        return $this->searchService->search($narrowedQuery, $limit, $start, $sort);
39
    }
40
}
41